Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- ## Use this and additional cells to continue to explore the dataset. ##
- ## Once you have performed your exploration, document your findings ##
- ## in the Markdown cell above. ##
- filename='./data/Washington-2016-Summary.csv'
- def monthly_riders(filename):
- with open(filename, 'r') as f_in:
- reader = csv.DictReader(f_in)
- month_dict={'January':[],
- 'February':[],
- 'March':[],
- 'April':[],
- 'May':[],
- 'June':[],
- 'July':[],
- 'August':[],
- 'September':[],
- 'October':[],
- 'November':[],
- 'December':[]}
- for row in reader:
- if(row['month']=='1'):
- month_dict['January'].append(row['duration'])
- elif(row['month']=='2'):
- month_dict['February'].append(row['duration'])
- elif(row['month']=='3'):
- month_dict['March'].append(row['duration'])
- elif(row['month']=='4'):
- month_dict['April'].append(row['duration'])
- elif(row['month']=='5'):
- month_dict['May'].append(row['duration'])
- elif(row['month']=='6'):
- month_dict['June'].append(row['duration'])
- elif(row['month']=='7'):
- month_dict['July'].append(row['duration'])
- elif(row['month']=='8'):
- month_dict['August'].append(row['duration'])
- elif(row['month']=='9'):
- month_dict['September'].append(row['duration'])
- elif(row['month']=='10'):
- month_dict['October'].append(row['duration'])
- elif(row['month']=='11'):
- month_dict['November'].append(row['duration'])
- elif(row['month']=='12'):
- month_dict['December'].append(row['duration'])
- trip_monthly_counts=[len(month_dict['January']),len(month_dict['February']),len(month_dict['March']),len(month_dict['April']),len(month_dict['May']),len(month_dict['June']),len(month_dict['July']),len(month_dict['August']),len(month_dict['September']),len(month_dict['October']),len(month_dict['November']),len(month_dict['December'])]
- return trip_monthly_counts
- #print(monthly_riders(filename))
- data=monthly_riders(filename)
- print(data)
- plt.plot(data)
- plt.show()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement