This is an analysis of the Citi Bike bike sharing program, which operaties in New York City. Of all the Citi Bike stations, we want to know which is the most popular, so that we can focus our attention on that station for further data analysis. Using open data, we count the number of times that each station appears as either a start station or end station on a trip, and we identify the most popular station as Pershing Square North, with 12,810 entries in January 2016, and so we can focus on this station for further analysis.
In [23]:
import csv
stations=[]
filename='/home/jl7333/Citi-Bike/data/201601-data.csv'
with open(filename,'r') as csvfile:
filereader=csv.reader(csvfile,delimiter=',')
header=next(filereader)
for row in filereader:
stations.append(row[4])
stations.append(row[8])
counts={}
uniquestations=set(stations)
for station in uniquestations:
counts[station]=stations.count(station)
maxcount=0
maxstation=""
for key in counts:
if counts[key]>=maxcount:
maxcount=counts[key]
maxstation=key
print('The most pupular stations is',maxstation,'with',maxcount,'entries.')
In [ ]: