Skip to content

Instantly share code, notes, and snippets.

View patrickmpoon's full-sized avatar

Patrick Poon patrickmpoon

View GitHub Profile
@patrickmpoon
patrickmpoon / useful_pandas_snippets.py
Created December 18, 2017 17:49 — 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!
@patrickmpoon
patrickmpoon / gist:160e3953b3a5bb0a9de215d9498d88e8
Created September 8, 2017 02:29 — forked from CristinaSolana/gist:1885435
Keeping a fork up to date

1. Clone your fork:

git clone [email protected]:YOUR-USERNAME/YOUR-FORKED-REPO.git

2. Add remote from original repository in your forked repository:

cd into/cloned/fork-repo
git remote add upstream git://github.com/ORIGINAL-DEV-USERNAME/REPO-YOU-FORKED-FROM.git
git fetch upstream