Skip to content

Instantly share code, notes, and snippets.

View osteth's full-sized avatar

Seth Wahle osteth

View GitHub Profile
@osteth
osteth / useful_pandas_snippets.py
Created August 15, 2018 15:32 — 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!