Skip to content

Instantly share code, notes, and snippets.

/f.py Secret

Created July 21, 2015 22:10
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save anonymous/dde72c69eec66a94975b to your computer and use it in GitHub Desktop.
Save anonymous/dde72c69eec66a94975b to your computer and use it in GitHub Desktop.
# Get the day of week from each date. Starts with Monday as 0.
turnstile_weather['day_week'] = turnstile_weather['DATEn'].map(lambda x: x.weekday())
df_by_day = turnstile_weather.groupby('day_week', as_index=False).sum()
label_list = [ '', 'Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat', 'Sun']
# Plot with day of week relabeled as abreviation
gg = ggplot(df_by_day, aes('day_week', 'ENTRIESn_hourly')) + \
geom_bar(stat='identity', fill='red') + \
ggtitle('Rush by day of week') + \
scale_x_discrete(labels=label_list) + \
xlab('Day of week') + \
ylab('Entries')
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment