Skip to content

DOC: mention both mirror methods #57009

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 2 commits into from
Jan 22, 2024
Merged
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
17 changes: 10 additions & 7 deletions pandas/core/generic.py
Original file line number Diff line number Diff line change
Expand Up @@ -10858,25 +10858,28 @@ def where(

Returns
-------
Same type as caller or None if ``inplace=True``.
Series or DataFrame unless ``inplace=True`` in which case
returns None.

See Also
--------
:func:`DataFrame.{name_other}` : Return an object of same shape as
self.
caller.
:func:`Series.{name_other}` : Return an object of same shape as
caller.

Notes
-----
The {name} method is an application of the if-then idiom. For each
element in the calling DataFrame, if ``cond`` is ``{cond}`` the
element is used; otherwise the corresponding element from the DataFrame
element in the caller, if ``cond`` is ``{cond}`` the
element is used; otherwise the corresponding element from
``other`` is used. If the axis of ``other`` does not align with axis of
``cond`` {klass}, the values of ``cond`` on misaligned index positions
will be filled with {cond_rev}.

The signature for :func:`DataFrame.where` differs from
:func:`numpy.where`. Roughly ``df1.where(m, df2)`` is equivalent to
``np.where(m, df1, df2)``.
The signature for :func:`Series.where` or
:func:`DataFrame.where` differs from :func:`numpy.where`.
Roughly ``df1.where(m, df2)`` is equivalent to ``np.where(m, df1, df2)``.

For further details and examples see the ``{name}`` documentation in
:ref:`indexing <indexing.where_mask>`.
Expand Down