Reputation: 135
I am working on a dataset that has How can I change Elements and Area with numbers before modelling
Elements
Area
Upvotes: 0
Views: 18
Reputation: 862431
If need factorize for strings columns use:
factorize
cols = df.select_dtypes(object).columns df[cols] = df[cols].apply(lambda x: pd.factorize(x)[0])
Upvotes: 1