INNER CODE UNIT · Python

prep_kaggle_data_on_tfl_trips

aeturrell/coding-for-economists · data_set_prep.py:179

def prep_kaggle_data_on_tfl_trips():
    """Prep a sliver of Kaggle data on tfl trips for the tables page.
    Note that this uses data from this url: https://www.kaggle.com/code/benivitai/tfl-oyster-card-journeys-analysis
    This function expects that the csv file, Nov09JnyExport.csv, has been extracted and downloaded
    to data/data_not_stored/
    """

    tfl = pd.read_csv(Path("data/data_not_stored/Nov09JnyExport.csv"))
    tfl = clean_columns(tfl)
    # cast columns
    data_type_dict = {
        "downo": "int",
        "daytype": "category",
        "sub_system": "category",
        "start_stn": "category",
        "end_station": "category",
        "ent_time": "int",
        "ex_time": "int",

View source record →

📰 Research Paper
Loading…
⏳ Fetching content…