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

28 Apr 2023

seaborn plotting pandas pd.Timedeltas

Really nice relevant tutorial: How to handle time series data with ease — pandas 2.1.0.dev0+658.gc9de03effb documentation

Make pd.Timedelta plottable

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]')

Pandas filter by deltas

# Gaps longer than one day
Nel mezzo del deserto posso dire tutto quello che voglio.