<jupyter_start><jupyter_text><NAME>Data 515Homework 1 If necessary, run the curl command below to obtain the data. However, if you clone the whole repo not just this notebook, the data file will be put in the /data directory already.<jupyter_code>!curl -o ../data/Fremont_Bridge_Hourly_Bicycle_Counts_by_Month_October_2012_to_present.csv https://data.seattle.gov/api/views/65db-xm6k/rows.csv?accessType=DOWNLOAD<jupyter_output>% Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100 1596k    0 1596k    0     0  1067k      0 --:--:--  0:00:01 --:--:-- 1067k<jupyter_text>1. Read the CSV file into a pandas dataframe. (1 pt)<jupyter_code>import pandas as pd
df = pd.read_csv('../data/Fremont_Bridge_Hourly_Bicycle_Counts_by_Month_October_2012_to_present.csv')
df.head()<jupyter_output><empty_output><jupyter_text>2. Add columns to the dataframe containing: ( 3 pt)   1. The total (East + West) bicycle count<jupyter_code>df['Total'] = df['Fremont Bridge East Sidewalk'] + df['Fremont Bridge West Sidewalk']
df.head()<jupyter_output><empty_output><jupyter_text>B. The hour of the day<jupyter_code>df['Hour'] = df['Date'].str[11:22]
df.head()<jupyter_output><empty_output><jupyter_text>C. The year<jupyter_code>df['Year'] = df['Date'].str[6:10]
df.head()<jupyter_output><empty_output><jupyter_text>3. Create a dataframe with the subset of data from the year 2016 (1 pt)<jupyter_code>df2016 = df[df['Year'] == '2016']
df2016.head()<jupyter_output><empty_output><jupyter_text>4. Use pandas + matplotlib to plot the counts by hour. (i.e. hour of the day on the x-axis, total daily counts on the y-axis) (1 pt)<jupyter_code>%matplotlib inline
import matplotlib.pyplot as plt
plt.plot(df['Hour'],df['Total'])
plt.xlabel('Hour')
plt.ylabel('Total')
plt.show()<jupyter_output><empty_output><jupyter_text>5. Use pandas to determine what is (on average) the busiest hour of the day (1 pt)<jupyter_code>df_busy = df.groupby(['Hour']).mean()
df_busy['Total'].max()
df_busy[df_busy['Total']==df_busy['Total'].max()].iloc[:,0:0]<jupyter_output><empty_output>
{'fraction_non_alphanumeric': 0.13513513513513514, 'fraction_numerical': 0.03681267474370923, 'mean_word_length': 5.259475218658892, 'pattern_counts': {'":': 0, '<': 33, '<?xml version=': 0, '>': 33, 'https://': 1, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 1, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'chain_length': '8', 'dir': 'jupyter-structured-clean-dedup', 'id': '443363', 'license': 'MIT', 'n_tokens_mistral': 857, 'n_tokens_neox': 791, 'n_words': 185, 'path': 'analysis/hw1.ipynb', 'repo_name': 'UWSEDS/manipulating-data-in-python-PKing70', 'size': '2152'}