In the middle of the desert you can say anything you want
sns.color_palette("flare")
# to reverse
sns.color_palette("flare_r")
# to uniform (=not categorical)
sns.color_palette("flare_r",as_cmap=True)
Properties of Mark objects — seaborn 0.12.2 documentation & matplotlib.markers — Matplotlib 3.7.1 documentation
Really nice relevant tutorial: How to handle time series data with ease — pandas 2.1.0.dev0+658.gc9de03effb documentation
sns.boxplot(data=s_dsm_conv, y='Dauer', x='Parameter')
> TypeError: Neither the `x` nor `y` variable appears to be numeric.
pd.TimeDelta
is indeed not numeric, but can be made one through
s_dsm_conv['Dauer'] = s_dsm_conv['Dauer'].astype('timedelta64[h]')
# Gaps longer than one day
real_gaps=gaps[gaps>pd.Timedelta(1,"d")]
[Code]-Drop Rows with Non-Numeric Entries in a Column (Python)-pandas shows one way to do this using pd.to_numeric()
1:
df['Gm#'] = pd.to_numeric(df['Gm#'], errors='coerce')
df = df.dropna(subset=['Gm#'])
Select the lines to sort, then :sort
.
When you’re looking at two files in two separate splits, :diffthis
is the magic command.
Neat for manually diffing parts of jsons.
Previously: 230313-1423 json diff with jq
_
Wanted w
/b
in python not to skip over underscores, that is consider underscores word separators.
set iskeyword?
shows the current/default value:
iskeyword=@,48-57,,_,192-255
iskeyword=@,48-57,_
Not digging to deep, removing _
gives me the wanted behaviour. Python got even easier now. (Keeping the ~/.vimrc
as-is though).
EDIT: OK, but this breaks <C-*>
and I can’t quickly jump between functions. Sad :( Rolling back…
IdeaVim supports camel case motions! Of course it does: ]w
, [w
, ]b
, [b
I’m happy for my custom keyboard layout where brackets are REALLY close and usable. I love this.
But for pycharm, remapped them, giving me what I want:
map w [w
map e ]w
map b [b
When using black, this cryptic message
error: cannot format /experiment.py: cannot use --safe with this file; failed to parse source file.
happens to me only when I have a stray trailing comma in my imports:
from typing import Optional, Tuple,
a_{multiplechars}
|modulo|
Problem: jupyter notebooks being shown as text on my website.
Adding the following to a .htaccess
file prevents files being “shown” in the browser, as opposed to downloaded1:
<FilesMatch "\.(?i:doc|odf|pdf|rtf|txt|ipynb)$">
Header set Content-Disposition attachment
</FilesMatch>
Also 2 that there’s a HTML syntax for that in links now!
<a href="./my_file.txt" download>
ls
has --color=always
, but not everyone does.
sudo apt install expect-dev
provides unbuffer
1, that when prefixed to a command makes it think it’s running in an interactive CLI, even if it’s piped or redirected etc.
For example this would preserve the colors in timew month
’s output while changing text:
unbuffer timew month 2022-02-01 - 2022-04-01 | sed "s/what/ever/g"
Was trying to code a “is this a sortable thing or not” thing, saw the documentation for collections, and it’s awesome: collections.abc — Abstract Base Classes for Containers — Python 3.11.3 documentation
The table of base classes has who inherits from whom (Set
from Collection
), which abstract methods it has (__contains__
) etc.
Definitely worth reading in full. As the rest of the very very readable Python docs.