you can use pandas.get_dummies() <http://pandas.pydata.org/pandas-docs/stable/generated/pandas.get_dummies.html>. It will perform one hot encoding on categorical columns, and produce a dataframe as the result. From there you can use pandas.concat([existing_df, new_df],axis=0) to add the new columns to your existing dataframe. This will avoid the use of a numpy array.
On Wed, Dec 7, 2016 at 8:44 AM, Nilay Shrivastava <[email protected]> wrote: > StandardScaler returns numpy array even if the object passed is a pandas > dataframe, shouldn't it return a dataframe? > > > _______________________________________________ > scikit-learn mailing list > [email protected] > https://mail.python.org/mailman/listinfo/scikit-learn > >
_______________________________________________ scikit-learn mailing list [email protected] https://mail.python.org/mailman/listinfo/scikit-learn
