Skip to content

DOC: use Hashable instead of label #61500

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 1 commit into from
May 27, 2025
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 @@ -337,15 +337,15 @@
to SQL left anti join; preserve key order.
* right_anti: use only keys from right frame that are not in left frame, similar
to SQL right anti join; preserve key order.
on : label or list
on : Hashable or a sequence of the previous
Column or index level names to join on. These must be found in both
DataFrames. If `on` is None and not merging on indexes then this defaults
to the intersection of the columns in both DataFrames.
left_on : label or list, or array-like
left_on : Hashable or a sequence of the previous, or array-like
Column or index level names to join on in the left DataFrame. Can also
be an array or list of arrays of the length of the left DataFrame.
These arrays are treated as if they are columns.
right_on : label or list, or array-like
right_on : Hashable or a sequence of the previous, or array-like
Column or index level names to join on in the right DataFrame. Can also
be an array or list of arrays of the length of the right DataFrame.
These arrays are treated as if they are columns.
Expand Down Expand Up @@ -7395,7 +7395,7 @@ def value_counts(

Parameters
----------
subset : label or list of labels, optional
subset : Hashable or a sequence of the previous, optional
Columns to use when counting unique combinations.
normalize : bool, default False
Return proportions rather than frequencies.
Expand Down Expand Up @@ -7546,7 +7546,7 @@ def nlargest(
----------
n : int
Number of rows to return.
columns : label or list of labels
columns : Hashable or a sequence of the previous
Column label(s) to order by.
keep : {'first', 'last', 'all'}, default 'first'
Where there are duplicate values:
Expand Down
6 changes: 3 additions & 3 deletions pandas/core/indexes/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -1913,12 +1913,12 @@ def set_names(self, names, *, level=None, inplace: bool = False) -> Self | None:
Parameters
----------

names : label or list of label or dict-like for MultiIndex
names : Hashable or a sequence of the previous or dict-like for MultiIndex
Name(s) to set.

.. versionchanged:: 1.3.0

level : int, label or list of int or label, optional
level : int, Hashable or a sequence of the previous, optional
If the index is a MultiIndex and names is not dict-like, level(s) to set
(None for all levels). Otherwise level must be None.

Expand Down Expand Up @@ -2023,7 +2023,7 @@ def rename(self, name, *, inplace: bool = False) -> Self | None:

Parameters
----------
name : label or list of labels
name : Hashable or a sequence of the previous
Name(s) to set.
inplace : bool, default False
Modifies the object directly, instead of creating a new Index or
Expand Down
12 changes: 6 additions & 6 deletions pandas/core/reshape/merge.py
Original file line number Diff line number Diff line change
Expand Up @@ -198,15 +198,15 @@ def merge(
to SQL left anti join; preserve key order.
* right_anti: use only keys from right frame that are not in left frame, similar
to SQL right anti join; preserve key order.
on : label or list
on : Hashable or a sequence of the previous
Column or index level names to join on. These must be found in both
DataFrames. If `on` is None and not merging on indexes then this defaults
to the intersection of the columns in both DataFrames.
left_on : label or list, or array-like
left_on : Hashable or a sequence of the previous, or array-like
Copy link
Member

Choose a reason for hiding this comment

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

Not sure if a sequence of the previous already means array-like. No big deal, but I guess it could be removed.

Copy link
Contributor Author

@cmp0xff cmp0xff May 27, 2025

Choose a reason for hiding this comment

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

My experience was that numpy.typing.NDArray is somehow not a collections.abc.Sequence, and numpy.typing.ArrayLike is even more complicated than an NDArray. That was why I left them as separate things.

Column or index level names to join on in the left DataFrame. Can also
be an array or list of arrays of the length of the left DataFrame.
These arrays are treated as if they are columns.
right_on : label or list, or array-like
right_on : Hashable or a sequence of the previous, or array-like
Column or index level names to join on in the right DataFrame. Can also
be an array or list of arrays of the length of the right DataFrame.
These arrays are treated as if they are columns.
Expand Down Expand Up @@ -536,13 +536,13 @@ def merge_ordered(
First pandas object to merge.
right : DataFrame or named Series
Second pandas object to merge.
on : label or list
on : Hashable or a sequence of the previous
Field names to join on. Must be found in both DataFrames.
left_on : label or list, or array-like
left_on : Hashable or a sequence of the previous, or array-like
Field names to join on in left DataFrame. Can be a vector or list of
vectors of the length of the DataFrame to use a particular vector as
the join key instead of columns.
right_on : label or list, or array-like
right_on : Hashable or a sequence of the previous, or array-like
Field names to join on in right DataFrame or vector/list of vectors per
left_on docs.
left_by : column name or list of column names
Expand Down
Loading