<jupyter_start><jupyter_text>Run again but count gender breakdown as well<jupyter_code>cb_pre = citibike.loc[(citibike.starttime < after_start)].copy()
cb_post = citibike.loc[(citibike.starttime > after_start)].copy()
gender_pre_daily =  cb_pre.groupby(['Date', 'gender']).agg({'Count':'count'})
gender_post_daily =  cb_post.groupby(['Date', 'gender']).agg({'Count':'count'})
gender_pre_daily = gender_pre_daily.reset_index()
gender_post_daily = gender_post_daily.reset_index()
gender_pre_daily['Date']  = pd.to_datetime(gender_pre_daily['Date']).copy()
gender_post_daily['Date']  = pd.to_datetime(gender_post_daily['Date']).copy()
gender_pre_daily = gender_pre_daily.loc[(gender_pre_daily.Date > (datetime.strptime(before_start, '%Y-%m-%d')))]
gender_post_daily = gender_post_daily.loc[(gender_post_daily.Date < (datetime.strptime(after_end, '%Y-%m-%d')))]
gender_pre_daily = gender_pre_daily.pivot(index = 'Date', columns = 'gender', values = 'Count').dropna()
gender_post_daily = gender_post_daily.pivot(index = 'Date', columns = 'gender', values = 'Count').dropna()
gender_post_daily.head()
MalePre = (sum(gender_pre_daily[1].values))
MalePost = (sum(gender_post_daily[1].values))
FemalePre = (sum(gender_pre_daily[2].values)) 
FemalePost = (sum(gender_post_daily[2].values))
#Plot Gender breakdown between years 1 and 2
groups = ['M', 'F']
year1 = [MalePre, FemalePre]
year2 = [MalePost,  FemalePost]

X_axis = np.arange(len(groups))

plt.bar(X_axis - 0.25, year1, 0.4, label = 'Year 1')
plt.bar(X_axis + 0.25, year2, 0.4, label = 'Year 2')
plt.title(f"Citibike Ridership By Gender over {zone} Before and After Bike Lane Enhancement")
plt.legend()
plt.xticks(X_axis, groups)
plt.show()<jupyter_output><empty_output><jupyter_text>Breakdown subscriber vs customer<jupyter_code>cb_pre = citibike.loc[(citibike.starttime < after_start)].copy()
cb_post = citibike.loc[(citibike.starttime > after_start)].copy()
cb_pre.usertype.unique()
type_pre_daily =  cb_pre.groupby(['Date', 'usertype']).agg({'Count':'count'})
type_post_daily =  cb_post.groupby(['Date', 'usertype']).agg({'Count':'count'})
type_pre_daily = type_pre_daily.reset_index()
type_post_daily = type_post_daily.reset_index()
type_pre_daily['Date']  = pd.to_datetime(type_pre_daily['Date']).copy()
type_post_daily['Date']  = pd.to_datetime(type_post_daily['Date']).copy()
type_pre_daily = type_pre_daily.loc[(type_pre_daily.Date > (datetime.strptime(before_start, '%Y-%m-%d')))]
type_post_daily = type_post_daily.loc[(type_post_daily.Date < (datetime.strptime(after_end, '%Y-%m-%d')))]
type_pre_daily.head()
type_pre_daily = type_pre_daily.pivot(index = 'Date', columns = 'usertype', values = 'Count').dropna()
type_post_daily = type_post_daily.pivot(index = 'Date', columns = 'usertype', values = 'Count').dropna()
type_post_daily.head()
CustPre = (sum(type_pre_daily['Customer'].values))
CustPost = (sum(type_post_daily['Customer'].values))
SubPre = (sum(type_pre_daily['Subscriber'].values)) 
SubPost = (sum(type_post_daily['Subscriber'].values))
#Plot Gender breakdown between years 1 and 2
groups = ['Guest', 'Subscriber']
year1 = [SubPre, CustPre]
year2 = [SubPost,  CustPost]

X_axis = np.arange(len(groups))

plt.bar(X_axis - 0.25, year1, 0.4, label = '2017')
plt.bar(X_axis + 0.25, year2, 0.4, label = '2018')
plt.title(f"Citibike Ridership By Rider Type over {zone} Before and After Bike Lane Enhancement")
plt.legend()
plt.xticks(X_axis, groups)
plt.show()<jupyter_output><empty_output>
{'fraction_non_alphanumeric': 0.17085862966175194, 'fraction_numerical': 0.0132986412257878, 'mean_word_length': 7.849104859335038, 'pattern_counts': {'":': 0, '<': 13, '<?xml version=': 0, '>': 13, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'chain_length': '2', 'dir': 'jupyter-structured-clean-dedup', 'id': '607203', 'license': 'MIT', 'n_tokens_mistral': 1401, 'n_tokens_neox': 1273, 'n_words': 210, 'path': 'notebooks/na0002_cb_before_after_analysis.ipynb', 'repo_name': 'cpcarey/nyu-cusp-ads-bike', 'size': '3459'}