serhii.net

In the middle of the desert you can say anything you want

05 Nov 2020

Day 675

qutebrowser new profile and basedir

Created a new basedir, where I symlinked the config.py from the original one: 11399 5.11.2020 09:54 ln -s ~/.config/qutebrowser/config.py ../profile2/config/config.py

To run with it, python3 qutebrowser.py -B ../profile2 (-B is the same as --basedir)

My use case would be to run a separate instance with tabs on top instead of in the left, for jupyter and similar. I can’t set tab position per window in the same profile.

zshrc aliases for output and copy

As I seem to do that often:

xrealpath() {
    realpath "$1"
    realpath "$1" | xc
}

xpwd() {
    pwd
    pwd | xc
}

Both outputs to screen and saves to buffer. xc is still this:

 alias xp='xclip -selection clipboard o'

pandas nullable integer data type

Nullable integer data type — pandas 1.1.4 documentation Usual int cannot contain NaN values, and things like df[0].astype(int) fail in that case.

To use nullable ints: df[0].astype('Int64'). (Note - it’s a string. int works both ways.)

pandas styling

Pandas can do styling! Had no idea: Styling — pandas 1.1.4 documentation

def _color_original(s):
    if s[5]==-1:
        return ['background-color: lightgrey']*len(s)
    elif s[5]>0.9:
        return ['background-color: #a5a1ff']*len(s)
    elif s[5]>0.8:
        return ['background-color: #bebaff']*len(s)
    elif s[5]>0.7:
        return ['background-color: #d8d6ff']*len(s)
    else:
        #print(s)
        return ['background-color: white']*len(s)

df.style.apply(_color_original, axis=1)

style.applymap() is elementwise, style.apply() is per row/column/table.

Nel mezzo del deserto posso dire tutto quello che voglio.
comments powered by Disqus