Skip to content

Commit 2edb63d

Browse files
committed
Merge branch 'fix-chap06-wind-stats' of https://github.com/TakaakiFuruse/pandas_exercises into TakaakiFuruse-fix-chap06-wind-stats
2 parents c913c0e + 2fdf179 commit 2edb63d

File tree

1 file changed

+7
-5
lines changed

1 file changed

+7
-5
lines changed

06_Stats/Wind_Stats/Exercises_with_solutions.ipynb

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,7 @@
8787
"cell_type": "markdown",
8888
"metadata": {},
8989
"source": [
90-
"### Step 2. Import the dataset from this [address](https://github.com/guipsamora/pandas_exercises/blob/master/Stats/Wind_Stats/wind.data)"
90+
"### Step 2. Import the dataset from this [address](https://github.com/guipsamora/pandas_exercises/blob/master/06_Stats/Wind_Stats/wind.data)"
9191
]
9292
},
9393
{
@@ -235,7 +235,8 @@
235235
],
236236
"source": [
237237
"# parse_dates gets 0, 1, 2 columns and parses them as the index\n",
238-
"data = pd.read_table(\"wind.data\", sep = \"\\s+\", parse_dates = [[0,1,2]]) \n",
238+
"data_url = 'https://raw.githubusercontent.com/guipsamora/pandas_exercises/master/06_Stats/Wind_Stats/wind.data'\n",
239+
"data = pd.read_table(data_url, sep = \"\\s+\", parse_dates = [[0,1,2]]) \n",
239240
"data.head()"
240241
]
241242
},
@@ -848,7 +849,7 @@
848849
"data['year'] = data['date'].apply(lambda date: date.year)\n",
849850
"data['day'] = data['date'].apply(lambda date: date.day)\n",
850851
"\n",
851-
"# gets all value from the month 1 and assign to janyary_winds\n",
852+
"# gets all value from the month 1 and assign to january_winds\n",
852853
"january_winds = data.query('month == 1')\n",
853854
"\n",
854855
"# gets the mean from january_winds, using .loc to not print the mean of month, year and day\n",
@@ -4209,7 +4210,8 @@
42094210
],
42104211
"source": [
42114212
"# call data again but this time don't use parse_dates\n",
4212-
"wind_data = pd.read_table(\"wind.data\", sep = \"\\s+\") \n",
4213+
"data_url = 'https://raw.githubusercontent.com/guipsamora/pandas_exercises/master/06_Stats/Wind_Stats/wind.data'\n",
4214+
"wind_data = pd.read_table(data_url, sep = \"\\s+\") \n",
42134215
"\n",
42144216
"# compute the month number for each day in the dataset, there are in total 216 months\n",
42154217
"wind_data['months_num'] = (wind_data.iloc[:, 0] - 61) * 12 + wind_data.iloc[:, 1]\n",
@@ -4603,7 +4605,7 @@
46034605
"weekly = data.resample('W').agg(['min','max','mean','std'])\n",
46044606
"\n",
46054607
"# slice it for the first 52 weeks and locations\n",
4606-
"weekly.ix[1:53, \"RPT\":\"MAL\"].head(10)"
4608+
"weekly.loc[weekly.index[1:53], \"RPT\":\"MAL\"] .head(10)"
46074609
]
46084610
}
46094611
],

0 commit comments

Comments
 (0)