Skip to content

fix(doc): #61432 typing #61455

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 5 additions & 5 deletions pandas/core/frame.py
Original file line number Diff line number Diff line change
Expand Up @@ -9177,11 +9177,11 @@ def groupby(

Parameters
----------%s
columns : str or object or a list of str
columns : Hashable or a sequence of the previous
Column to use to make new frame's columns.
index : str or object or a list of str, 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 : str, object or a list 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.
Expand Down Expand Up @@ -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
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is tuple treated the same as other sequences here? (I haven't checked)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for observing the potential danger. index and columns are processed by

    index = _convert_by(index)
    columns = _convert_by(columns)

which converts by using by = list(by).

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
Expand Down
6 changes: 6 additions & 0 deletions pandas/core/indexes/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
--------
Expand Down
10 changes: 5 additions & 5 deletions pandas/core/reshape/pivot.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -708,11 +708,11 @@ def pivot(
----------
data : DataFrame
Input pandas DataFrame object.
columns : str or object or a list of str
columns : Hashable or a sequence of the previous
Column to use to make new frame's columns.
index : str or object or a list of str, 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 : str, object or a list 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.
Expand Down
Loading