From f25957d38c019250447d6125e631b2fb8865673f Mon Sep 17 00:00:00 2001 From: Yi-Fan Wang Date: Mon, 19 May 2025 09:29:44 +0200 Subject: [PATCH 1/3] fix(doc): #61432 typing --- pandas/core/frame.py | 6 +++--- pandas/core/indexes/base.py | 6 ++++++ pandas/core/reshape/pivot.py | 6 +++--- 3 files changed, 12 insertions(+), 6 deletions(-) diff --git a/pandas/core/frame.py b/pandas/core/frame.py index 6158e19737185..bfac630078d99 100644 --- a/pandas/core/frame.py +++ b/pandas/core/frame.py @@ -9177,11 +9177,11 @@ def groupby( Parameters ----------%s - columns : str or object or a list of str + columns : label or object or a list of previous Column to use to make new frame's columns. - index : str or object or a list of str, optional + index : label or object or a list of the previous, optional Column to use to make new frame's index. If not given, uses existing index. - values : str, object or a list of the previous, optional + values : label, object or a list of the previous, optional Column(s) to use for populating new frame's values. If not specified, all remaining columns will be used and the result will have hierarchically indexed columns. diff --git a/pandas/core/indexes/base.py b/pandas/core/indexes/base.py index ff3879018674e..9df0787a4560d 100644 --- a/pandas/core/indexes/base.py +++ b/pandas/core/indexes/base.py @@ -1731,10 +1731,16 @@ def name(self) -> Hashable: """ Return Index or MultiIndex name. + Returns + ------- + label (hashable object) + The name of the Index. + See Also -------- Index.set_names: Able to set new names partially and by level. Index.rename: Able to set new names partially and by level. + Series.name: Corresponding Series property. Examples -------- diff --git a/pandas/core/reshape/pivot.py b/pandas/core/reshape/pivot.py index 4e77f0a6bf5bf..646a9c5bed176 100644 --- a/pandas/core/reshape/pivot.py +++ b/pandas/core/reshape/pivot.py @@ -708,11 +708,11 @@ def pivot( ---------- data : DataFrame Input pandas DataFrame object. - columns : str or object or a list of str + columns : label or object or a list of the previous Column to use to make new frame's columns. - index : str or object or a list of str, optional + index : label or object or a list of the previous, optional Column to use to make new frame's index. If not given, uses existing index. - values : str, object or a list of the previous, optional + values : label, object or a list of the previous, optional Column(s) to use for populating new frame's values. If not specified, all remaining columns will be used and the result will have hierarchically indexed columns. From a95127b5f17c96f513b1ee2b7f7743b661826146 Mon Sep 17 00:00:00 2001 From: cmp0xff Date: Mon, 19 May 2025 18:11:47 +0200 Subject: [PATCH 2/3] fix(comment): https://github.com/pandas-dev/pandas/pull/61455/files#r2096066367 --- pandas/core/frame.py | 10 +++++----- pandas/core/reshape/pivot.py | 10 +++++----- 2 files changed, 10 insertions(+), 10 deletions(-) diff --git a/pandas/core/frame.py b/pandas/core/frame.py index bfac630078d99..8d1c68b881255 100644 --- a/pandas/core/frame.py +++ b/pandas/core/frame.py @@ -9177,11 +9177,11 @@ def groupby( Parameters ----------%s - columns : label or object or a list of previous + columns : label or a sequence of the previous Column to use to make new frame's columns. - index : label or object or a list of the previous, optional + index : label or a sequence of the previous, optional Column to use to make new frame's index. If not given, uses existing index. - values : label, object or a list of the previous, optional + values : label or a sequence of the previous, optional Column(s) to use for populating new frame's values. If not specified, all remaining columns will be used and the result will have hierarchically indexed columns. @@ -9320,12 +9320,12 @@ def pivot( ----------%s values : list-like or scalar, optional Column or columns to aggregate. - index : column, Grouper, array, or list of the previous + index : column, Grouper, array, or sequence of the previous Keys to group by on the pivot table index. If a list is passed, it can contain any of the other types (except list). If an array is passed, it must be the same length as the data and will be used in the same manner as column values. - columns : column, Grouper, array, or list of the previous + columns : column, Grouper, array, or sequence of the previous Keys to group by on the pivot table column. If a list is passed, it can contain any of the other types (except list). If an array is passed, it must be the same length as the data and will be used in diff --git a/pandas/core/reshape/pivot.py b/pandas/core/reshape/pivot.py index 646a9c5bed176..3fccfffc5155d 100644 --- a/pandas/core/reshape/pivot.py +++ b/pandas/core/reshape/pivot.py @@ -76,12 +76,12 @@ def pivot_table( Input pandas DataFrame object. values : list-like or scalar, optional Column or columns to aggregate. - index : column, Grouper, array, or list of the previous + index : column, Grouper, array, or sequence of the previous Keys to group by on the pivot table index. If a list is passed, it can contain any of the other types (except list). If an array is passed, it must be the same length as the data and will be used in the same manner as column values. - columns : column, Grouper, array, or list of the previous + columns : column, Grouper, array, or sequence of the previous Keys to group by on the pivot table column. If a list is passed, it can contain any of the other types (except list). If an array is passed, it must be the same length as the data and will be used in @@ -708,11 +708,11 @@ def pivot( ---------- data : DataFrame Input pandas DataFrame object. - columns : label or object or a list of the previous + columns : label or a sequence of the previous Column to use to make new frame's columns. - index : label or object or a list of the previous, optional + index : label or a sequence of the previous, optional Column to use to make new frame's index. If not given, uses existing index. - values : label, object or a list of the previous, optional + values : label or a sequence of the previous, optional Column(s) to use for populating new frame's values. If not specified, all remaining columns will be used and the result will have hierarchically indexed columns. From ccf060c55e57e49938b15d31c2fd12f27d66843b Mon Sep 17 00:00:00 2001 From: cmp0xff Date: Tue, 20 May 2025 09:25:28 +0200 Subject: [PATCH 3/3] fix(comment): https://github.com/pandas-dev/pandas/pull/61455#discussion_r2096069007 --- pandas/core/frame.py | 6 +++--- pandas/core/reshape/pivot.py | 6 +++--- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/pandas/core/frame.py b/pandas/core/frame.py index 8d1c68b881255..4770184a7de03 100644 --- a/pandas/core/frame.py +++ b/pandas/core/frame.py @@ -9177,11 +9177,11 @@ def groupby( Parameters ----------%s - columns : label or a sequence of the previous + columns : Hashable or a sequence of the previous Column to use to make new frame's columns. - index : label or a sequence of the previous, optional + index : Hashable or a sequence of the previous, optional Column to use to make new frame's index. If not given, uses existing index. - values : label or a sequence of the previous, optional + values : Hashable or a sequence of the previous, optional Column(s) to use for populating new frame's values. If not specified, all remaining columns will be used and the result will have hierarchically indexed columns. diff --git a/pandas/core/reshape/pivot.py b/pandas/core/reshape/pivot.py index 3fccfffc5155d..ac89f19b80a0f 100644 --- a/pandas/core/reshape/pivot.py +++ b/pandas/core/reshape/pivot.py @@ -708,11 +708,11 @@ def pivot( ---------- data : DataFrame Input pandas DataFrame object. - columns : label or a sequence of the previous + columns : Hashable or a sequence of the previous Column to use to make new frame's columns. - index : label or a sequence of the previous, optional + index : Hashable or a sequence of the previous, optional Column to use to make new frame's index. If not given, uses existing index. - values : label or a sequence of the previous, optional + values : Hashable or a sequence of the previous, optional Column(s) to use for populating new frame's values. If not specified, all remaining columns will be used and the result will have hierarchically indexed columns.