Skip to content

Instantly share code, notes, and snippets.

View jerisalan's full-sized avatar
:bowtie:

Jeris Alan jerisalan

:bowtie:
View GitHub Profile
@jerisalan
jerisalan / useful_pandas_snippets.py
Created February 19, 2018 00:40 — 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!