You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: doc/source/whatsnew/v0.19.0.txt
+34-2
Original file line number
Diff line number
Diff line change
@@ -488,8 +488,8 @@ including ``DataFrame`` (:issue:`1134`, :issue:`4581`, :issue:`13538`)
488
488
489
489
.. warning::
490
490
Until 0.18.1, comparing ``Series`` with the same length has been succeeded even if
491
-
these ``index`` are different (the result ignores ``index``).
492
-
As of 0.19.1, it raises ``ValueError`` to be more strict.
491
+
these ``index`` are different (the result ignores ``index``). As of 0.19.0, it raises ``ValueError`` to be more strict. This section also describes how to keep previous behaviour or align different indexes using flexible comparison methods like ``.eq``.
492
+
493
493
494
494
As a result, ``Series`` and ``DataFrame`` operators behave as below:
495
495
@@ -534,6 +534,15 @@ New Behavior (``Series``):
534
534
Out[2]:
535
535
ValueError: Can only compare identically-labeled Series objects
536
536
537
+
.. note::
538
+
To achieve the same result as previous versions (compare values based on locations ignoring ``index``), compare both ``.values``.
539
+
540
+
.. ipython:: python
541
+
542
+
s1.values == s2.values
543
+
544
+
If you want to compare ``Series`` aligning its ``index``, see flexible comparison methods section below.
545
+
537
546
Current Behavior (``DataFrame``, no change):
538
547
539
548
.. code-block:: ipython
@@ -573,6 +582,13 @@ New Behavior (``Series``):
573
582
.. note::
574
583
``Series`` logical operators fill ``NaN`` result with ``False``.
575
584
585
+
.. note::
586
+
To achieve the same result as previous versions (compare values based on locations ignoring ``index``), compare both ``.values``.
587
+
588
+
.. ipython:: python
589
+
590
+
s1.values & s2.values
591
+
576
592
Current Behavior (``DataFrame``, no change):
577
593
578
594
.. ipython:: python
@@ -581,6 +597,21 @@ Current Behavior (``DataFrame``, no change):
``Series`` flexible comparison methods like ``eq``, ``ne``, ``le``, ``lt``, ``ge`` and ``gt`` now align both ``index``. Use these operators if you want to compare two ``Series``
604
+
which has the different ``index``.
605
+
606
+
.. ipython:: python
607
+
608
+
s1 = pd.Series([1, 2, 3], index=['a', 'b', 'c'])
609
+
s2 = pd.Series([2, 2, 2], index=['b', 'c', 'd'])
610
+
s1.eq(s2)
611
+
s1.ge(s2)
612
+
613
+
Previously, it worked as the same as comparison operators (see above).
614
+
584
615
.. _whatsnew_0190.api.promote:
585
616
586
617
``Series`` type promotion on assignment
@@ -1175,6 +1206,7 @@ Bug Fixes
1175
1206
- Bug in using NumPy ufunc with ``PeriodIndex`` to add or subtract integer raise ``IncompatibleFrequency``. Note that using standard operator like ``+`` or ``-`` is recommended, because standard operators use more efficient path (:issue:`13980`)
1176
1207
1177
1208
- Bug in operations on ``NaT`` returning ``float`` instead of ``datetime64[ns]`` (:issue:`12941`)
1209
+
- Bug in ``Series`` flexible arithmetic methods (like ``.add()``) raises ``ValueError`` when ``axis=None`` (:issue:`13894`)
1178
1210
1179
1211
- Bug in ``pd.read_csv`` in Python 2.x with non-UTF8 encoded, multi-character separated data (:issue:`3404`)
0 commit comments