def reduce_memory_usage(df):
usage_pre = df.memory_usage(deep=True).sum()<EOL>if "<STR_LIT>" in df:<EOL><INDENT>df.loc[:, "<STR_LIT>"] = df.loc[:, "<STR_LIT>"].astype("<STR_LIT>")<EOL><DEDENT>df_int = df.select_dtypes(include=['<STR_LIT:int>'])<EOL>df_float = df.select_dtypes(include=['<STR_LIT:float>'])<EOL>df.loc[:, df_int.columns] = df_int.apply(pd.to_numeric, downcast='<STR_LIT>')<EOL>df.loc[:, df_float.columns] = df_float.apply(pd.to_numeric, downcast='<STR_LIT:float>')<EOL>usage_post = df.memory_usage(deep=True).sum()<EOL>logging.info("<STR_LIT>".format(<EOL>usage_pre / <NUM_LIT>**<NUM_LIT:2>, usage_post / <NUM_LIT>**<NUM_LIT:2>))<EOL>if usage_post > <NUM_LIT> and "<STR_LIT>" in df:<EOL><INDENT>logging.info("<STR_LIT>")<EOL>return df.drop(["<STR_LIT>"], axis=<NUM_LIT:1>, errors="<STR_LIT:ignore>")<EOL><DEDENT>else:<EOL><INDENT>return df<EOL><DEDENT>
reduce memory usage of the dataframe

    - convert runIDs to categorical
    - downcast ints and floats