Skip to content

Commit 9e39794

Browse files
Albert Villanova del Moraljreback
Albert Villanova del Moral
authored andcommitted
Address requested changes
1 parent 5bf1508 commit 9e39794

File tree

2 files changed

+6
-162
lines changed

2 files changed

+6
-162
lines changed

doc/source/whatsnew/v0.20.0.txt

+6-71
Original file line numberDiff line numberDiff line change
@@ -309,7 +309,6 @@ Other enhancements
309309
- ``pd.types.concat.union_categoricals`` gained the ``ignore_ordered`` argument to allow ignoring the ordered attribute of unioned categoricals (:issue:`13410`). See the :ref:`categorical union docs <categorical.union>` for more information.
310310
- ``pandas.io.json.json_normalize()`` with an empty ``list`` will return an empty ``DataFrame`` (:issue:`15534`)
311311
- ``pd.DataFrame.to_latex`` and ``pd.DataFrame.to_string`` now allow optional header aliases. (:issue:`15536`)
312-
- ``Index.join()`` accepts parameter ``sort`` (:issue:`15582`)
313312

314313
.. _ISO 8601 duration: https://en.wikipedia.org/wiki/ISO_8601#Durations
315314

@@ -746,11 +745,9 @@ Index order after inner join due to Index intersection
746745

747746
The ``Index.intersection`` now preserves the order of the calling Index (left)
748747
instead of the other Index (right) (:issue:`15582`). This affects the inner
749-
joins (methods ``Index.join``, ``DataFrame.join``, ``DataFrame.merge`` and
750-
``pd.merge``) and the alignments with inner join (methods ``Series.align`` and
751-
``DataFrame.align``).
748+
joins (methods ``DataFrame.join`` and ``pd.merge``) and the .align methods.
752749

753-
- ``Index.intersection`` and ``Index.join``
750+
- ``Index.intersection``
754751

755752
.. ipython:: python
756753

@@ -766,52 +763,13 @@ joins (methods ``Index.join``, ``DataFrame.join``, ``DataFrame.merge`` and
766763
In [4]: idx1.intersection(idx2)
767764
Out[4]: Int64Index([1, 2], dtype='int64')
768765

769-
In [5]: idx1.join(idx2, how='inner')
770-
Out[5]: Int64Index([1, 2], dtype='int64')
771-
772766
New Behavior:
773767

774768
.. ipython:: python
775769

776770
idx1.intersection(idx2)
777-
idx1.join(idx2, how='inner')
778771

779-
- ``Series.align``
780-
781-
.. ipython:: python
782-
783-
s1 = pd.Series([20, 10, 0], index=[2, 1, 0])
784-
s1
785-
s2 = pd.Series([100, 200, 300], index=[1, 2, 3])
786-
s2
787-
788-
Previous Behavior:
789-
790-
.. code-block:: ipython
791-
792-
In [4]: (res1, res2) = s1.align(s2, join='inner')
793-
794-
In [5]: res1
795-
Out[5]:
796-
1 10
797-
2 20
798-
dtype: int64
799-
800-
In [6]: res2
801-
Out[6]:
802-
1 100
803-
2 200
804-
dtype: int64
805-
806-
New Behavior:
807-
808-
.. ipython:: python
809-
810-
(res1, res2) = s1.align(s2, join='inner')
811-
res1
812-
res2
813-
814-
- ``DataFrame.join``, ``DataFrame.merge`` and ``pd.merge``
772+
- ``DataFrame.join`` and ``pd.merge``
815773

816774
.. ipython:: python
817775

@@ -830,41 +788,18 @@ joins (methods ``Index.join``, ``DataFrame.join``, ``DataFrame.merge`` and
830788
1 10 100
831789
2 20 200
832790

833-
In [5]: df1.merge(df2, how='inner', left_index=True, right_index=True)
791+
In [5]: pd.merge(df1, df2, how='inner', left_index=True, right_index=True)
834792
Out[5]:
835793
a b
836794
1 10 100
837795
2 20 200
838796

839-
In [6]: pd.merge(df1, df2, how='inner', left_index=True, right_index=True)
840-
Out[6]:
841-
a b
842-
1 10 100
843-
2 20 200
844-
845-
In [7]: (res1, res2) = df1.align(df2, axis=0, join='inner')
846-
847-
In [8]: res1
848-
Out[8]:
849-
a
850-
1 10
851-
2 20
852-
853-
In [9]: res2
854-
Out[9]:
855-
b
856-
1 100
857-
2 200
858-
859797
New Behavior:
860798

861799
.. ipython:: python
862800

863801
df1.join(df2, how='inner')
864-
df1.merge(df2, how='inner', left_index=True, right_index=True)
865-
(res1, res2) = df1.align(df2, axis=0, join='inner')
866-
res1
867-
res2
802+
pd.merge(df1, df2, how='inner', left_index=True, right_index=True)
868803

869804

870805
.. _whatsnew_0200.api:
@@ -1103,4 +1038,4 @@ Bug Fixes
11031038
- Bug in ``pd.melt()`` where passing a tuple value for ``value_vars`` caused a ``TypeError`` (:issue:`15348`)
11041039
- Bug in ``.eval()`` which caused multiline evals to fail with local variables not on the first line (:issue:`15342`)
11051040
- Bug in ``pd.read_msgpack`` which did not allow to load dataframe with an index of type ``CategoricalIndex`` (:issue:`15487`)
1106-
- Bug with ``sort=True`` in ``DataFrame.join``, ``DataFrame.merge`` and ``pd.merge`` when joining on index (:issue:`15582`)
1041+
- Bug with ``sort=True`` in ``DataFrame.join`` and ``pd.merge`` when joining on indexes (:issue:`15582`)

pandas/tests/frame/test_merge.py

-91
This file was deleted.

0 commit comments

Comments
 (0)