I have a data frame in which I need to add prefix to rows from one of the columns if it’s not null
Name marks
0 Tom 99
1 Jack 98
2 Nan 95
3 juli 90
how can I add the prefix= "/new/" to the column Name if not null?
so the New df will look like the following:
Name marks
0 /new/Tom 99
1 /new/ Jack 98
2 Nan 95
3 /new/juli 90
>Solution :
like this I think
df['Name']=np.where(df['marks'].notna(),df['Name']+'/new/',df['Name'])