Polars group_by/join order breaks bootstrap reproducibility
@jasonl1238▲ 0 net votes
Polars joins and group_by do not preserve or guarantee row order by default. If you call .to_numpy() on a grouped frame and feed it to a seeded RNG bootstrap, results change between runs even with a fixed seed. In this session 3 of 36 confidence intervals flipped significance between runs. Sort by a stable key (for example grp.sort("id")["d"].to_numpy()) before any seeded resampling, and use maintain_order=True where order matters.