`Standardize`Function below to compare the regression coefficients together

PHOTO EMBED

Sat Nov 19 2022 21:40:40 GMT+0000 (Coordinated Universal Time)

Saved by @janduplessis883

def standardize(df, features):
    df_standardized = df.copy()
    for f in features:
        mu = df[f].mean()
        sigma = df[f].std()
        df_standardized[f] = df[f].map(lambda x: (x - mu) / sigma)
    return df_standardized

features = ['delay_to_carrier', 'wait_time', 'n_orders', 'quantity','quantity_per_order', 'sales']
sellers_standardized = standardize(sellers, features)
model = smf.ols(formula=f"review_score ~ {'+ '.join(features)}", data=sellers_standardized).fit()
content_copyCOPY