Skip to content

Commit 3462a0f

Browse files
author
Soledad Galli
committed
chapters 6 and 7
1 parent 2584f1f commit 3462a0f

11 files changed

+5320
-0
lines changed

ch6-outliers/Recipe1-Outlier-Trimming.ipynb

+499
Large diffs are not rendered by default.

ch6-outliers/Recipe2-Winsorisation.ipynb

+619
Large diffs are not rendered by default.

ch6-outliers/Recipe3-Capping.ipynb

+500
Large diffs are not rendered by default.

ch6-outliers/Recipe4-Zero-coding.ipynb

+455
Large diffs are not rendered by default.

ch7-datetime/Recipe1-Extracting-date-and-time-part.ipynb

+488
Large diffs are not rendered by default.

ch7-datetime/Recipe2-Deriving-year-month-semester-quarter.ipynb

+486
Large diffs are not rendered by default.

ch7-datetime/Recipe3-Creating-representations-of-week-day.ipynb

+619
Large diffs are not rendered by default.

ch7-datetime/Recipe4-Extracting-time-parts.ipynb

+475
Large diffs are not rendered by default.

ch7-datetime/Recipe5-Capturing-elapsed-time-between-2-variables.ipynb

+553
Large diffs are not rendered by default.

ch7-datetime/Recipe6--different-time-zones.ipynb

+464
Large diffs are not rendered by default.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,162 @@
1+
{
2+
"cells": [
3+
{
4+
"cell_type": "code",
5+
"execution_count": 1,
6+
"metadata": {},
7+
"outputs": [],
8+
"source": [
9+
"import pandas as pd\n",
10+
"import numpy as np"
11+
]
12+
},
13+
{
14+
"cell_type": "code",
15+
"execution_count": 2,
16+
"metadata": {},
17+
"outputs": [
18+
{
19+
"data": {
20+
"text/plain": [
21+
"(5, 3)"
22+
]
23+
},
24+
"execution_count": 2,
25+
"metadata": {},
26+
"output_type": "execute_result"
27+
}
28+
],
29+
"source": [
30+
"np.random.seed(29)\n",
31+
"\n",
32+
"rng_min = pd.date_range('2019-03-05', periods=5, freq='T')\n",
33+
"rng_day = pd.date_range('2019-03-05', periods=5, freq='D')\n",
34+
"\n",
35+
"df = pd.DataFrame({ 'Date1': rng_min, 'Date2': rng_day, 'Val': np.random.randn(len(rng_min)) })\n",
36+
"df.shape"
37+
]
38+
},
39+
{
40+
"cell_type": "code",
41+
"execution_count": 3,
42+
"metadata": {},
43+
"outputs": [
44+
{
45+
"data": {
46+
"text/html": [
47+
"<div>\n",
48+
"<style scoped>\n",
49+
" .dataframe tbody tr th:only-of-type {\n",
50+
" vertical-align: middle;\n",
51+
" }\n",
52+
"\n",
53+
" .dataframe tbody tr th {\n",
54+
" vertical-align: top;\n",
55+
" }\n",
56+
"\n",
57+
" .dataframe thead th {\n",
58+
" text-align: right;\n",
59+
" }\n",
60+
"</style>\n",
61+
"<table border=\"1\" class=\"dataframe\">\n",
62+
" <thead>\n",
63+
" <tr style=\"text-align: right;\">\n",
64+
" <th></th>\n",
65+
" <th>Date1</th>\n",
66+
" <th>Date2</th>\n",
67+
" <th>Val</th>\n",
68+
" </tr>\n",
69+
" </thead>\n",
70+
" <tbody>\n",
71+
" <tr>\n",
72+
" <th>0</th>\n",
73+
" <td>2019-03-05 00:00:00</td>\n",
74+
" <td>2019-03-05</td>\n",
75+
" <td>-0.417482</td>\n",
76+
" </tr>\n",
77+
" <tr>\n",
78+
" <th>1</th>\n",
79+
" <td>2019-03-05 00:01:00</td>\n",
80+
" <td>2019-03-06</td>\n",
81+
" <td>0.706032</td>\n",
82+
" </tr>\n",
83+
" <tr>\n",
84+
" <th>2</th>\n",
85+
" <td>2019-03-05 00:02:00</td>\n",
86+
" <td>2019-03-07</td>\n",
87+
" <td>1.915985</td>\n",
88+
" </tr>\n",
89+
" <tr>\n",
90+
" <th>3</th>\n",
91+
" <td>2019-03-05 00:03:00</td>\n",
92+
" <td>2019-03-08</td>\n",
93+
" <td>-2.141755</td>\n",
94+
" </tr>\n",
95+
" <tr>\n",
96+
" <th>4</th>\n",
97+
" <td>2019-03-05 00:04:00</td>\n",
98+
" <td>2019-03-09</td>\n",
99+
" <td>0.719057</td>\n",
100+
" </tr>\n",
101+
" </tbody>\n",
102+
"</table>\n",
103+
"</div>"
104+
],
105+
"text/plain": [
106+
" Date1 Date2 Val\n",
107+
"0 2019-03-05 00:00:00 2019-03-05 -0.417482\n",
108+
"1 2019-03-05 00:01:00 2019-03-06 0.706032\n",
109+
"2 2019-03-05 00:02:00 2019-03-07 1.915985\n",
110+
"3 2019-03-05 00:03:00 2019-03-08 -2.141755\n",
111+
"4 2019-03-05 00:04:00 2019-03-09 0.719057"
112+
]
113+
},
114+
"execution_count": 3,
115+
"metadata": {},
116+
"output_type": "execute_result"
117+
}
118+
],
119+
"source": [
120+
"df"
121+
]
122+
},
123+
{
124+
"cell_type": "code",
125+
"execution_count": null,
126+
"metadata": {},
127+
"outputs": [],
128+
"source": []
129+
}
130+
],
131+
"metadata": {
132+
"kernelspec": {
133+
"display_name": "feml",
134+
"language": "python",
135+
"name": "feml"
136+
},
137+
"language_info": {
138+
"codemirror_mode": {
139+
"name": "ipython",
140+
"version": 3
141+
},
142+
"file_extension": ".py",
143+
"mimetype": "text/x-python",
144+
"name": "python",
145+
"nbconvert_exporter": "python",
146+
"pygments_lexer": "ipython3",
147+
"version": "3.7.3"
148+
},
149+
"toc": {
150+
"nav_menu": {},
151+
"number_sections": true,
152+
"sideBar": true,
153+
"skip_h1_title": false,
154+
"toc_cell": false,
155+
"toc_position": {},
156+
"toc_section_display": "block",
157+
"toc_window_display": false
158+
}
159+
},
160+
"nbformat": 4,
161+
"nbformat_minor": 2
162+
}

0 commit comments

Comments
 (0)