-
Notifications
You must be signed in to change notification settings - Fork 177
Open
Labels
enhancementNew feature or requestNew feature or request
Description
This is something I'd quite like to see. In Polars too, but it's easier to implement here 😄
There's an example in the Polars docs about how to do a lazy pivot: https://docs.pola.rs/api/python/stable/reference/dataframe/api/polars.DataFrame.pivot.html
API-wise, we could have:
def pivot(
self: Self,
on: str | list[str],
*,
column_names: list[str],
index: str | list[str] | None = None,
values: str | list[str] | None = None,
aggregate_function: Literal[
"min", "max", "sum", "mean", "median", "len"
]
| None = None,
separator: str = "_",
) -> Self:This is very similar to DataFrame.pivot, but requires specifying the output column names explicitly so that the computation can stay completely lazy
Metadata
Metadata
Assignees
Labels
enhancementNew feature or requestNew feature or request