Jul-20-2018, 07:41 AM
I am getting the following
df_pre = df_pre.rename(columns={error_cols: 'p{}_{}'.format(q, error_cols)})
which is contained in this function
Error:TypeError: unhashable type: 'list'
for this line df_pre = df_pre.rename(columns={error_cols: 'p{}_{}'.format(q, error_cols)})
which is contained in this function
def get_metrics(df, q, error_cols): df_pre = df[df.order_delivery_leg == 'pre-accept'] df_pre = df_pre.groupby(['region_name'])[error_cols].quantile(q).reset_index() df_pre = df_pre.rename(columns={error_cols: 'p{}_{}'.format(q, error_cols)}) return df_preWhen I call it in my main module using this function
pre_startP25, pickup_startP25, del_startP25 = prepare_data.get_metrics(start,0.25, ['time_to_actual_pickup_error', 'time_to_actual_dropoff_error'])Is the way I am renaming the column incorrect?