pola-rs / polars

Dataframes powered by a multithreaded, vectorized query engine, written in Rust
https://docs.pola.rs
Other
26.9k stars 1.65k forks source link

DataFrame.group_by.GroupBy.head(n: int) should support negative ints #16239

Open thomasb-gr opened 2 weeks ago

thomasb-gr commented 2 weeks ago

Description

polars.DataFrame.head(n) supports negative n to fetch all but the last n rows, but DataFrame.group_by.GroupBy.head(n) does not offer the same functionality. I can work around this by calculating the length manually and then using that, but it seems odd that these two functions behave differently depending on what I'm applying them to.