Например,
Код: Выделить всё
import polars as pl
df = pl.DataFrame(dict(x=[1,1,1,2,3,3,3], y=[1,2,3,4,5,6,7]))
df.group_by("x").agg(pl.all().gather([0, 2]))
Подробнее здесь: https://stackoverflow.com/questions/761 ... e-not-even
Код: Выделить всё
import polars as pl
df = pl.DataFrame(dict(x=[1,1,1,2,3,3,3], y=[1,2,3,4,5,6,7]))
df.group_by("x").agg(pl.all().gather([0, 2]))