From 06e4fa47c4d894501eaa197b3de9af172523b4b2 Mon Sep 17 00:00:00 2001 From: deanm0000 <37878412+deanm0000@users.noreply.github.com> Date: Mon, 5 Aug 2024 03:34:50 -0400 Subject: [PATCH] docs: Update pivot docstring for clarity (#18000) --- py-polars/polars/dataframe/frame.py | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/py-polars/polars/dataframe/frame.py b/py-polars/polars/dataframe/frame.py index 2d85a141e93f..ccf16204e79b 100644 --- a/py-polars/polars/dataframe/frame.py +++ b/py-polars/polars/dataframe/frame.py @@ -7828,16 +7828,18 @@ def pivot( Parameters ---------- on - Name of the column(s) whose values will be used as the header of the output + The column(s) whose values will be used as the new columns of the output DataFrame. index - One or multiple keys to group by. If None, all remaining columns not specified - on `on` and `values` will be used. At least one of `index` and `values` must - be specified. + The column(s) that remain from the input to the output. The output DataFrame will have one row + for each unique combination of the `index`'s values. + If None, all remaining columns not specified on `on` and `values` will be used. At least one + of `index` and `values` must be specified. values - One or multiple keys to group by. If None, all remaining columns not specified - on `on` and `index` will be used. At least one of `index` and `values` must - be specified. + The existing column(s) of values which will be moved under the new columns from index. If an + aggregation is specified, these are the values on which the aggregation will be computed. + If None, all remaining columns not specified on `on` and `index` will be used. + At least one of `index` and `values` must be specified. aggregate_function Choose from: