(no title)
cmdlineluser | 2 years ago
In Python, I have been finding Polars nicer to use:
(purchases
.filter(pl.col("amount") <= pl.col("amount").median().over("country") * 10)
.group_by("country")
.agg(total = (pl.col("amount") - pl.col("discount")).sum())
)
Not as compact as the R example but gets a bit closer compared to the pandas approach.
d0mine|2 years ago
anakaine|2 years ago
d0mine|2 years ago
wodenokoto|2 years ago