Skip to content

Instantly share code, notes, and snippets.

@merishnaSuwal
Created November 9, 2020 03:31
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save merishnaSuwal/2cc5dee6d544b326b9708d772232baa1 to your computer and use it in GitHub Desktop.
Save merishnaSuwal/2cc5dee6d544b326b9708d772232baa1 to your computer and use it in GitHub Desktop.
# Selecting columns with data type as 'object'
columns = dataset.columns[dataset.dtypes.eq('object')]
# Convert to numeric values
dataset[columns] = dataset[columns].apply(pd.to_numeric, errors='coerce')
# Viewing the details
dataset.info()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment