pythonpandasdataframe

How to easily standardise pandas dataframe


I have below pandas dataframe

import pandas as pd
dat = pd.DataFrame({'AA': [1, 2], 'BB': [3,4]})

I am looking for a direct way to standardise each column like in SAS we have PROC STDIZE.

Is there any direct method available with pandas?


Solution

  • You could try dat_norm = (dat - dat.mean())/dat.std()