I have a polars dataframe like this one:
shape: (10, 2)┌────────┬───────┐│ foo ┆ bar ││ --- ┆ --- ││ i64 ┆ i64 │╞════════╪═══════╡│ 86 ┆ 11592 ││ 109 ┆ 2765 ││ 109 ┆ 4228 ││ 153 ┆ 4214 ││ 153 ┆ 7217 ││ 153 ┆ 11095 ││ 160 ┆ 1134 ││ 222 ┆ 5509 ││ 225 ┆ 10150 ││ 239 ┆ 4151 │└────────┴───────┘And a sorted list of integers points:
points = [0, 1500, 3000, 4500, 6000, 7500, 9000, 10500, 12000]I want to create a new column baz, such that for each element y of bar, I find the largest x in points such that x =< y. Then the element of baz is y - x. How can I do that?