Advertisement
elena1234

update column values with apply in Python

May 21st, 2022
884
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  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
RAW Paste Data Copied
Advertisement