TWIL - Calculate days between sales using polars

The solution I settled with in the end was: df.group_by( "customer", "product_type" ).agg( pl.col.date.diff().dt.total_days().alias("DiffDays"), ).with_columns( pl.col.DiffDays.list.mean().round(1).alias("Avg_Days_Between_Deals") ).drop("DiffDays") I am currently doing quite a bit of revenue data analysis at my job. The other day my manager came up to me and told me that he wanted to add additional KPIs to the analysis. The given dataset looks like that: date [str] product_type [str] customer [str] revenue [float64] 2024-05-10 Product A Example Corp 3400....

August 17, 2025 · 2 min · 361 words · Max Häming

Interactivly Exploring Layer Activations in Marimo

This article dives into Marimo as an alternative to Jupyter Notebooks. If you are in a hurry and only interested in the neural network activation section, jump to it right away. What is wrong with Jupyter Notebooks? Unclear dependency definition Almost everybody working with Jupyter notebooks has experienced this problem before: A colleague sends you their notebook with the newest visualizations of the data science project your team is working on....

January 8, 2025 · 7 min · 1396 words · Max Häming