azure - convert string into numeric data in the dataframe using python -
if have field in dataframe
a12 a13 a13 a12 a14
we need convert string into
a12 1 a13 2 a13 2 a12 1 a14 3
try this:
arr=dataframe['old_col'].unique() dataframe['new_col']=dataframe['old_col'].apply(lambda x: arr.index(x))
Comments
Post a Comment