I want to apply scaling (using StandardScaler() from sklearn.preprocessing) to a pandas dataframe. The following code returns a numpy array, so I lose all the column names a
import pandas as pd from sklearn.preprocessing import StandardScaler df = pd.read_csv('your file here') ss = StandardScaler() df_scaled = pd.DataFrame(ss.fit_transform(df),columns = df.columns)
The df_scaled will be the 'same' dataframe, only now with the scaled values