Replacing The Value In New Data Frame Python
As you seen on the image we have three columns so i need to write code that can create new columns called aa and replace when whever see A replace it with 1 or B replace it 2 ETC.
Solution 1:
IIUC use:
df['aa'] = df['categories'].map(df.drop_duplicates('categories').set_index('categories')['WOF'])
Post a Comment for "Replacing The Value In New Data Frame Python"