Skip to content

Instantly share code, notes, and snippets.

View skt7's full-sized avatar

Shivam Thakkar skt7

  • Mumbai, Maharastra, India
  • X @pyskt7
View GitHub Profile
@skt7
skt7 / useful_pandas_snippets.py
Created April 13, 2018 22:53 — forked from yjw868/useful_pandas_snippets.py
Useful Pandas Snippets
# List unique values in a DataFrame column
# h/t @makmanalp for the updated syntax!
df['Column Name'].unique()
# Convert Series datatype to numeric (will error if column has non-numeric values)
# h/t @makmanalp
pd.to_numeric(df['Column Name'])
# Convert Series datatype to numeric, changing non-numeric values to NaN
# h/t @makmanalp for the updated syntax!