Skip to content

DOC: whatsnew for array_ufunc #27188

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 3 commits into from
Jul 3, 2019
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
42 changes: 42 additions & 0 deletions doc/source/whatsnew/v0.25.0.rst
Original file line number Diff line number Diff line change
Expand Up @@ -620,6 +620,48 @@ previous behavior of returning overlapping matches.
s[idxr]
s.loc[idxr]


.. _whatsnew_0250.api_breaking.ufunc:

Binary ufuncs on Series now align
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

Applying a binary ufunc like :func:`numpy.power` now aligns the inputs
when both are :class:`Series` (:issue:`23293`).

.. ipython:: python

s1 = pd.Series([1, 2, 3], index=['a', 'b', 'c'])
s2 = pd.Series([3, 4, 5], index=['d', 'c', 'b'])
s1
s2

*Previous behavior*

.. code-block:: python

In [5]: np.power(s1, s2)
Out[5]:
a 1
b 16
c 243
dtype: int64

*New behavior*

.. ipython:: python

np.power(s1, s2)

This matches the behavior of other binary operations in pandas, like :meth:`Series.add`.
To retain the previous behavior, convert the other ``Series`` to an array before
applying the ufunc.

.. ipython:: python

np.power(s1, s2.array)


.. _whatsnew_0250.api_breaking.deps:

Increased minimum versions for dependencies
Expand Down