Git diff

Is much more flexible than expected. git diff --unified=0 doesn’t show the context lines, only the changed ones; in general the documentation is worth reading, could be a good tool to add to my belt for various one-off tasks.

pandas convert entire dataframe to str / value type

df.applymap(str) converts everythnig to str. df.applymap() applies a function to a Dataframe elementwise. (TODO anki)

pandas import numpy

If I don’t want to do import numpy as np separately (for things like np.nan), pd.np.nan works! 1

pandas remove NaN/nan in str

np.nan in the dataframe can be removed w/ df.fillna(''), but after getting converted to string the NaN become nan and have to be removed by the string operation. As a string operation, it’s important to watch out for strings containing nans, for example:

pd.DataFrame({'one':['two','three','four',pd.np.nan,23,'nonanme']}).applymap(str).replace('nan','',regex=True) would change the last element. All answers here seem to have this issue.

So to remove them from a string representation, pd.DataFrame({'one':['two','three','four',pd.np.nan,23,'nonanme']}).applymap(str).replace('^nan$','',regex=True) works, with a regex for nan.

qutebrowser leave passthrough mode

Changed keybinding to config.bind('<Ctrl-Shift-+>', 'leave-mode', mode='passthrough'), which translates to <C-S-=>, but it seems to see = as + because Shift is being pressed.