technical notes

A collection of quick reference notes.

Python

Pandas

Split Column Containg Tuple

test_df = pd.DataFrame({'animal':['Dog', 'Bunny'], 
                        'food_sound':[('Bone','Woof'), ('Carrot','Squeak')]})

test_df[['Food', 'Sound']] = pd.DataFrame(test_df['food_sound'].tolist(), 
                                          index=test_df.index)

Jupyter

Dead Kernel

  • Managing Python installation using Homebrew and Pip3 (not using Anaconda)
  • After updating Python version, Jupyter notebook doesn’t connect to new version/keeps trying to reference older version.

List available Jupyter kernels; will return list of kernels with filepaths:

jupyter kernelspec list

Navigate into the kernel you want to edit:

cd /Users/sarah/Library/Jupyter/kernels/python3

View contents of kernel JSON:

cat /Users/sarah/Library/Jupyter/kernels/python3/kernel.json

Edit kernel JSON to update path to Python version:

vi /Users/sarah/Library/Jupyter/kernels/python3/kernel.json

To quit the editor and save the changes, press the escape key and then type ‘:wq’ (without single quotes). Verify the changes are saved by running cat {kernel filepath} again.