Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- days = []
- df = turnstile_weather
- def day(date):
- return datetime.strftime(datetime.strptime(date,'%Y-%m-%d').date(),'%a')
- for date in turnstile_weather['DATEn']:
- days.append(day(date))
- df['Days'] = days
- df['UNIT_int'] = df['UNIT'].str.strip('R').astype(int)
- grouping = df.groupby(['UNIT_int', 'Days']).sum()
- print grouping
- #group = pandas.melt(grouping, id_vars = 'UNIT', value_name = 'ENTRIESn_hourly', var_name = 'Day')
- plot = ggplot(grouping, aes('UNIT_int', 'ENTRIESn_hourly',
- colour='day_week')) + \
- geom_point(alpha=.1) + \
- ggtitle('Subway Ridership for Days of the Week') + \
- xlab('UNIT Number') + \
- ylab('Entries Per Hour')
- return plot
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement