Advertisement
elena1234

update column values with apply in Python

May 21st, 2022
1,072
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.15 KB | None | 0 0
  1. def convert_to_rating(x):
  2.     return (str(x) + '  out of 10')
  3.  
  4. df['rating'] = df['rating'].apply(convert_to_rating)  # 4.0 rating out of 10
  5. df.head()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement