<jupyter_start><jupyter_text>Download data<jupyter_code># # Create directory
# !mkdir ./data/seatle_bicycle_counts/

# # Curl command to download data
# !curl -o \
# ./data/seatle_bicycle_counts/FremontBridge.csv \
# https://data.seattle.gov/api/views/65db-xm6k/rows.csv?accessType=Download
fp = './data/seatle_bicycle_counts/FremontBridge.csv'
df = pd.read_csv(fp, index_col='Date', parse_dates=True)
df.info()
df.columns = ['total', 'east', 'west']
df.head()
df.dropna().describe()
df.plot(figsize=FIGSIZE);
weekly = df.resample('W').sum()
weekly.plot(style=[':', '--', '-'], figsize=FIGSIZE)
plt.ylabel('weekly bicyle count');
daily = df.resample('D').sum()
daily.rolling(30, center=True).sum().plot(style=[':', '--', '-'], figsize=FIGSIZE)
plt.ylabel('weekly bicycle count');
daily.rolling(50, center=True, win_type='gaussian').sum(std=10).plot(style=[':', '--', '-'], figsize=FIGSIZE);
by_time = df.groupby(df.index.time).mean()
hourly_ticks = 4*60*60 * np.arange(6)
by_time.plot(xticks=hourly_ticks, style=[':', '--', '-'], figsize=FIGSIZE);
by_weekday = df.groupby(df.index.dayofweek).mean()
by_weekday.index = WEEKDAYS
by_weekday.plot(figsize=FIGSIZE, style=[':', '--', '-']);
weekend = np.where(df.index.weekday < 5, 'Weekday', 'Weekend')
by_time = df.groupby([weekend, df.index.time]).mean()
fig, ax = plt.subplots(1, 2, figsize=(14, 5))
by_time.loc['Weekday'].plot(ax=ax[0], title='Weekdays', xticks=hourly_ticks, style=[':', '--', '-'])
by_time.loc['Weekend'].plot(ax=ax[1], title='Weekends', xticks=hourly_ticks, style=[':', '--', '-']);
df.groupby([df.index.dayofweek, df.index.time]).mean().plot(style=[':', '--', '-'], figsize=(14, 5));<jupyter_output><empty_output>
{'fraction_non_alphanumeric': 0.24673008323424495, 'fraction_numerical': 0.015457788347205707, 'mean_word_length': 6.317391304347826, 'pattern_counts': {'":': 0, '<': 6, '<?xml version=': 0, '>': 5, 'https://': 1, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 3, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'chain_length': '1', 'dir': 'jupyter-structured-clean-dedup', 'id': '407752', 'license': 'MIT', 'n_tokens_mistral': 712, 'n_tokens_neox': 682, 'n_words': 88, 'path': 'Seattle Bicycle Counts.ipynb', 'repo_name': 'Sabihxh/jupyter-notebooks', 'size': '1682'}