#!/usr/bin/env python # coding: utf-8 # In[1]: import pandas as pd import seaborn as sns import matplotlib.pyplot as plt get_ipython().run_line_magic('config', "InlineBackend.figure_format='retina'") # In[2]: df = pd.read_csv("austin_bikeshare_20191101.csv") # In[3]: df['start_time'] = pd.to_datetime(df['start_time']) df['start_date'] = df['start_time'].dt.date df['start_hour'] = df['start_time'].dt.hour # In[4]: date = '2019-11-05' print(date) # In[5]: filter_df = df[df['start_date'].astype(str) == date] # In[6]: filter_df.head() # In[7]: filter_df.groupby(['start_hour'])[['trip_id']].count().plot(); # In[8]: filter_df.groupby(['subscriber_type'])[['trip_id']].count().plot.barh(); # In[9]: filter_df.groupby(['start_station_id'])['start_station_id'].count().plot.barh(figsize=(20, 10)); # In[10]: plt.figure(figsize=(12,8)) plt.title("start station id count per start hour") sns.heatmap(filter_df.groupby(['start_hour', 'start_station_id'])[['start_station_id']].count().unstack(), lw=.5, annot=True, cmap='GnBu', fmt='g', annot_kws={'size':10}); # In[ ]: