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
@yjw868
yjw868 / useful_pandas_snippets.py
Created April 13, 2018 22:48 — forked from bsweger/useful_pandas_snippets.md
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!