Skip to content

Instantly share code, notes, and snippets.

@srang992
Created April 12, 2023 15:20
Show Gist options
  • Save srang992/134fa57009acf257d6e6de5068f2ca48 to your computer and use it in GitHub Desktop.
Save srang992/134fa57009acf257d6e6de5068f2ca48 to your computer and use it in GitHub Desktop.
# removing the '%' sign from the cocoa_percent column
choco_data['cocoa_percent'] = choco_data['cocoa_percent'].str.strip('%')
# converting the datatype
choco_data['cocoa_percent'] = choco_data['cocoa_percent'].astype('float')
# showing the first 5 rows
choco_data['cocoa_percent'].head()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment