import os
from urllib.request import urlretrieve
import pandas as pd

FREMONT_URL = 'https://data.seattle.gov/api/views/65db-xm6k/rows.csv?accessType=DOWNLOAD'

def get_fremont_data(filename = "fremont.csv", url = FREMONT_URL, force_download = False):
    """" Download and cache the fremont data. Returns data as pandas.dataframe"""
    if force_download or not os.path.exists(filename):
        urlretrieve(url, filename)
    data = pd.read_csv('fremont.csv', index_col ='Date', parse_dates = True)
    data.columns = ['West', 'East']
    data['Total'] = data['West'] + data['East']
    return data

@@ -476,29 +476,181 @@
 ate'
-, parse_dates = True)
+)%0A    %0A    try:%0A        data.index = pd.to_datetime(data.index, format='%25m/%25d/%25Y %25I:%25M:%25S %25p')%0A    except TypeError:%0A        data.index = pd.to_datetime(data.index)%0A        
 %0A   

refactor data download