In the middle of the desert you can say anything you want
A typo in a keybinding randomly led me to the graph view in Obsidian, never thought about it - but now apparently I have a lot of notes and it’s quite pretty!
I wanted to remove the #zc tag from graph view to make it clearer (since ALL notes have it basically.)
(177) How to hide tags, but keep notes with them in graph : ObsidianMD mentioned a way to do just that, though I’m not sure I understand it:
-(-path:folder (#tag1 OR #tag2 OR #tag3))
For me that’s:
-(-path:garden/it (#zc OR #zc/it))
# Display all columns and rows:
pd.set_option('display.max_columns', None)
pd.set_option('display.max_rows', None)
# Don't truncate values
pd.set_option('display.max_colwidth', None)
This of course works:
with pd.option_context('display.max_colwidth', None):
display(df)
Make cells 100% wide in Jupyter:
from IPython.core.display import display, HTML
display(HTML("<style>.container { width:100% !important; }</style>"))
And https://stackoverflow.com/a/51593236 has this function remarkably similar to the old one I’ve had, except that I changed print->display:
def print_full(x):
pd.set_option('display.max_rows', None)
pd.set_option('display.max_columns', None)
pd.set_option('display.width', 2000)
pd.set_option('display.float_format', '{:20,.2f}'.format)
pd.set_option('display.max_colwidth', None)
#print(x)
display(x)
pd.reset_option('display.max_rows')
pd.reset_option('display.max_columns')
pd.reset_option('display.width')
pd.reset_option('display.float_format')
pd.reset_option('display.max_colwidth')
Pandas convert column to categorial
pd.row_name.astype('category')
Pandas select numeric columns1:
ds.select_dtypes(include=[np.number])
Pandas divide columns by other column2:
(ds.T / ds.col2.T).T
python - Divide multiple columns by another column in pandas - Stack Overflow
3D plotting in matplotlib: Three-Dimensional Plotting in Matplotlib | Python Data Science Handbook & the official docu: 3D plotting — Matplotlib 3.7.1 documentation
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-255iskeyword=@,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>