Skip to content

Instantly share code, notes, and snippets.

View nnfuzzy's full-sized avatar

Christian Schulz nnfuzzy

View GitHub Profile
@nnfuzzy
nnfuzzy / useful_pandas_snippets.py
Last active November 26, 2018 10:36 — 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()
# For each unique value in a DataFrame column, get a frequency count
df['Column Name'].value_counts()
# Convert Series datatype to numeric (will error if column has non-numeric values)
# h/t @makmanalp
pd.to_numeric(df['Column Name'])