Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -348,7 +348,7 @@
}
],
"source": [
"berri_bikes.loc[:,'weekday'] = berri_bikes.index.weekday\n",
"berri_bikes['weekday'] = berri_bikes.index.weekday\n",
"berri_bikes[:5]"
]
},
Expand All @@ -367,7 +367,7 @@
"\n",
"Dataframes have a `.groupby()` method that is similar to SQL groupby, if you're familiar with that. I'm not going to explain more about it right now -- if you want to to know more, [the documentation](http://pandas.pydata.org/pandas-docs/stable/groupby.html) is really good.\n",
"\n",
"In this case, `berri_bikes.groupby('weekday').aggregate(sum)` means \"Group the rows by weekday and then add up all the values with the same weekday\"."
"In this case, `berri_bikes.groupby('weekday').sum()` means \"Group the rows by weekday and then add up all the values with the same weekday\"."
]
},
{
Expand Down Expand Up @@ -454,7 +454,7 @@
}
],
"source": [
"weekday_counts = berri_bikes.groupby('weekday').aggregate(sum)\n",
"weekday_counts = berri_bikes.groupby('weekday').sum()\n",
"weekday_counts"
]
},
Expand Down Expand Up @@ -634,10 +634,10 @@
" index_col='Date')\n",
"# Add the weekday column\n",
"berri_bikes = bikes[['Berri 1']].copy()\n",
"berri_bikes.loc[:,'weekday'] = berri_bikes.index.weekday\n",
"berri_bikes['weekday'] = berri_bikes.index.weekday\n",
"\n",
"# Add up the number of cyclists by weekday, and plot!\n",
"weekday_counts = berri_bikes.groupby('weekday').aggregate(sum)\n",
"weekday_counts = berri_bikes.groupby('weekday').sum()\n",
"weekday_counts.index = ['Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday', 'Saturday', 'Sunday']\n",
"weekday_counts.plot(kind='bar')"
]
Expand Down