generate functionFri, 31 Mar 2023

get the absolute error between the columns "EVa" from dataframe "df1" and "EVb" from dataframe "df2" grouped by the column "TV" conserving the column "TV" transformed to string

def get_absolute_error(df1, df2, col_a, col_b): return df1.groupby(df1['TV'].astype(str))[col_a] - df2.groupby(df2['TV'].astype(str))[col_b] get_absolute_error(df1, df2, 'EVa', 'EVb')

Want to kickstart your project?Use the new AI Studio to create your code