Skip to content

Instantly share code, notes, and snippets.

/ Secret

Created Jul 21, 2015
What would you like to do?
# 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') + \
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment