Search code examples
pandasdataframescikit-learnscaling

Scaling values in dataframe column?


I have a dataframe and I want to scale the values in each column to range from (0,1) and do not want to manually compute myself for each column. I saw sklearn's MinMaxScaler but I am not sure how to call this? To reiterate, I would want to call this on each column in the dataframe and ideally make the changes in place: MinMaxScaler(feature_range=(0, 1), copy=False). I am open to other simple approaches as well.


Solution

  • try this buddy

    df['normal_var'] = (df.var - df.var.min()) / (df.var.max() -df.var.min())