In [5]:
%matplotlib inline
import re, os
import matplotlib.pyplot as plt
import numpy as np
import pandas as pd
import seaborn as sns; sns.set()
from IPython.display import display
In [6]:
import sys; sys.path.insert(1, os.path.join(sys.path[0], '..'))
from utils.bikeshare import get_bikeshare_filename, get_year_quarter_tuples, download_bikeshare_data
In [7]:
years = [2015, 2016]
data_folder = "../data/bikeshare/"
os.makedirs(data_folder, exist_ok=True)
print("Downloading Capital Bikeshare Data for {years} to {folder}".format(years=years, folder=data_folder))
print()
for year, quarter in get_year_quarter_tuples(years):
download_bikeshare_data(year, quarter, data_folder)
In [8]:
df = pd.read_csv("../data/bikeshare/2016-Q1-cabi-trip-history-data.csv")
In [9]:
df.head()
Out[9]:
In [1]:
# df[(df.start_date.dt.dayofweek>=5)].start_date.dt.hour.value_counts().sort_index().plot()
# df[(df.start_date.dt.dayofweek<5)].start_date.dt.hour.value_counts().sort_index().plot()
In [ ]: