From 8e8aed73e99899f2f2447098343e83cfd6481bba Mon Sep 17 00:00:00 2001 From: wobweger Date: Mon, 17 Jun 2019 13:01:32 +0000 Subject: [PATCH] Upload New File --- 7_ifc/py/742_jupyter/stp10.ipynb | 471 +++++++++++++++++++++++++++++++ 1 file changed, 471 insertions(+) create mode 100644 7_ifc/py/742_jupyter/stp10.ipynb diff --git a/7_ifc/py/742_jupyter/stp10.ipynb b/7_ifc/py/742_jupyter/stp10.ipynb new file mode 100644 index 0000000..87447e6 --- /dev/null +++ b/7_ifc/py/742_jupyter/stp10.ipynb @@ -0,0 +1,471 @@ +{ + "cells": [ + { + "cell_type": "code", + "execution_count": 3, + "metadata": {}, + "outputs": [], + "source": [ + "import numpy as np\n", + "import pandas as pd" + ] + }, + { + "cell_type": "code", + "execution_count": 4, + "metadata": {}, + "outputs": [ + { + "data": { + "text/plain": [ + "0 1.0\n", + "1 3.0\n", + "2 5.0\n", + "3 NaN\n", + "4 6.0\n", + "5 8.0\n", + "dtype: float64" + ] + }, + "execution_count": 4, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "s = pd.Series([1, 3, 5, np.nan, 6, 8])\n", + "s" + ] + }, + { + "cell_type": "code", + "execution_count": 5, + "metadata": {}, + "outputs": [ + { + "data": { + "text/plain": [ + "DatetimeIndex(['2013-01-01', '2013-01-02', '2013-01-03', '2013-01-04',\n", + " '2013-01-05', '2013-01-06'],\n", + " dtype='datetime64[ns]', freq='D')" + ] + }, + "execution_count": 5, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "dates = pd.date_range('20130101', periods=6)\n", + "dates" + ] + }, + { + "cell_type": "code", + "execution_count": 6, + "metadata": {}, + "outputs": [ + { + "data": { + "text/html": [ + "
\n", + "\n", + "\n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + "
ABCD
2013-01-01-1.4807981.254959-0.3833030.170942
2013-01-02-0.0799492.0835940.359603-0.987005
2013-01-030.304971-1.527081-0.804382-0.044026
2013-01-041.176118-1.7955670.6105451.622611
2013-01-05-0.127968-0.2564330.810486-0.879474
2013-01-06-0.492543-0.4219610.7835741.088608
\n", + "
" + ], + "text/plain": [ + " A B C D\n", + "2013-01-01 -1.480798 1.254959 -0.383303 0.170942\n", + "2013-01-02 -0.079949 2.083594 0.359603 -0.987005\n", + "2013-01-03 0.304971 -1.527081 -0.804382 -0.044026\n", + "2013-01-04 1.176118 -1.795567 0.610545 1.622611\n", + "2013-01-05 -0.127968 -0.256433 0.810486 -0.879474\n", + "2013-01-06 -0.492543 -0.421961 0.783574 1.088608" + ] + }, + "execution_count": 6, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "df = pd.DataFrame(np.random.randn(6, 4), index=dates, columns=list('ABCD'))\n", + "df\n" + ] + }, + { + "cell_type": "code", + "execution_count": 7, + "metadata": {}, + "outputs": [ + { + "data": { + "text/html": [ + "
\n", + "\n", + "\n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + "
ABCDEF
01.02013-01-021.03testfoo
11.02013-01-021.03trainfoo
21.02013-01-021.03testfoo
31.02013-01-021.03trainfoo
\n", + "
" + ], + "text/plain": [ + " A B C D E F\n", + "0 1.0 2013-01-02 1.0 3 test foo\n", + "1 1.0 2013-01-02 1.0 3 train foo\n", + "2 1.0 2013-01-02 1.0 3 test foo\n", + "3 1.0 2013-01-02 1.0 3 train foo" + ] + }, + "execution_count": 7, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "df2 = pd.DataFrame({'A': 1.,\n", + " 'B': pd.Timestamp('20130102'),\n", + " 'C': pd.Series(1, index=list(range(4)), dtype='float32'),\n", + " 'D': np.array([3] * 4, dtype='int32'),\n", + " 'E': pd.Categorical([\"test\", \"train\", \"test\", \"train\"]),\n", + " 'F': 'foo'})\n", + "df2" + ] + }, + { + "cell_type": "code", + "execution_count": 8, + "metadata": {}, + "outputs": [ + { + "data": { + "text/html": [ + "
\n", + "\n", + "\n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + "
ABCD
2013-01-01-1.4807981.254959-0.3833030.170942
2013-01-02-0.0799492.0835940.359603-0.987005
\n", + "
" + ], + "text/plain": [ + " A B C D\n", + "2013-01-01 -1.480798 1.254959 -0.383303 0.170942\n", + "2013-01-02 -0.079949 2.083594 0.359603 -0.987005" + ] + }, + "execution_count": 8, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "df.head(2)\n" + ] + }, + { + "cell_type": "code", + "execution_count": 9, + "metadata": {}, + "outputs": [ + { + "data": { + "text/html": [ + "
\n", + "\n", + "\n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + "
ABCD
2013-01-041.176118-1.7955670.6105451.622611
2013-01-05-0.127968-0.2564330.810486-0.879474
2013-01-06-0.492543-0.4219610.7835741.088608
\n", + "
" + ], + "text/plain": [ + " A B C D\n", + "2013-01-04 1.176118 -1.795567 0.610545 1.622611\n", + "2013-01-05 -0.127968 -0.256433 0.810486 -0.879474\n", + "2013-01-06 -0.492543 -0.421961 0.783574 1.088608" + ] + }, + "execution_count": 9, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "df.tail(3)" + ] + }, + { + "cell_type": "code", + "execution_count": 10, + "metadata": {}, + "outputs": [ + { + "data": { + "text/plain": [ + "DatetimeIndex(['2013-01-01', '2013-01-02', '2013-01-03', '2013-01-04',\n", + " '2013-01-05', '2013-01-06'],\n", + " dtype='datetime64[ns]', freq='D')" + ] + }, + "execution_count": 10, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "df.index\n" + ] + }, + { + "cell_type": "code", + "execution_count": 11, + "metadata": {}, + "outputs": [ + { + "data": { + "text/plain": [ + "Index(['A', 'B', 'C', 'D'], dtype='object')" + ] + }, + "execution_count": 11, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "df.columns" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": {}, + "outputs": [], + "source": [] + } + ], + "metadata": { + "kernelspec": { + "display_name": "Python 3", + "language": "python", + "name": "python3" + }, + "language_info": { + "codemirror_mode": { + "name": "ipython", + "version": 3 + }, + "file_extension": ".py", + "mimetype": "text/x-python", + "name": "python", + "nbconvert_exporter": "python", + "pygments_lexer": "ipython3", + "version": "3.7.1" + } + }, + "nbformat": 4, + "nbformat_minor": 2 +} -- GitLab