Skip to content

Instantly share code, notes, and snippets.

View gitCheatsheet.md

how to push a local drafts branch to local master branch and remote master branch

git checkout drafts
git branch --set-upstream-to master

git push . HEAD:master
View pandas.ipynb
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@sammatuba
sammatuba / splitPandasSeriesOfTuplesIntoPandasDataframe.py
Last active Jan 17, 2023
quickHow: how to split a column of tuples into a pandas dataframe
View splitPandasSeriesOfTuplesIntoPandasDataframe.py
# Given a pandas dataframe containing a pandas series/column of tuples B,
# we want to extract B into B1 and B2 and assign them into separate pandas series
# Method 1: (faster)
# use pd.Series.tolist() method to return a list of tuples
# use pd.DataFrame on the resulting list to turn it into a new pd.DataFrame object, while specifying the original df index
# add to the original df
import pandas as pd
import time