Skip to content

Commit d9250f2

Browse files
author
Albert Villanova del Moral
committed
Address requested changes
1 parent 48823a7 commit d9250f2

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
@@ -308,7 +308,6 @@ Other enhancements
308308
- ``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.
309309
- ``pandas.io.json.json_normalize()`` with an empty ``list`` will return an empty ``DataFrame`` (:issue:`15534`)
310310
- ``pd.DataFrame.to_latex`` and ``pd.DataFrame.to_string`` now allow optional header aliases. (:issue:`15536`)
311-
- ``Index.join()`` accepts parameter ``sort`` (:issue:`15582`)
312311

313312

314313
.. _ISO 8601 duration: https://en.wikipedia.org/wiki/ISO_8601#Durations
@@ -714,11 +713,9 @@ Index order after inner join due to Index intersection
714713

715714
The ``Index.intersection`` now preserves the order of the calling Index (left)
716715
instead of the other Index (right) (:issue:`15582`). This affects the inner
717-
joins (methods ``Index.join``, ``DataFrame.join``, ``DataFrame.merge`` and
718-
``pd.merge``) and the alignments with inner join (methods ``Series.align`` and
719-
``DataFrame.align``).
716+
joins (methods ``DataFrame.join`` and ``pd.merge``) and the .align methods.
720717

721-
- ``Index.intersection`` and ``Index.join``
718+
- ``Index.intersection``
722719

723720
.. ipython:: python
724721

@@ -734,52 +731,13 @@ joins (methods ``Index.join``, ``DataFrame.join``, ``DataFrame.merge`` and
734731
In [4]: idx1.intersection(idx2)
735732
Out[4]: Int64Index([1, 2], dtype='int64')
736733

737-
In [5]: idx1.join(idx2, how='inner')
738-
Out[5]: Int64Index([1, 2], dtype='int64')
739-
740734
New Behavior:
741735

742736
.. ipython:: python
743737

744738
idx1.intersection(idx2)
745-
idx1.join(idx2, how='inner')
746739

747-
- ``Series.align``
748-
749-
.. ipython:: python
750-
751-
s1 = pd.Series([20, 10, 0], index=[2, 1, 0])
752-
s1
753-
s2 = pd.Series([100, 200, 300], index=[1, 2, 3])
754-
s2
755-
756-
Previous Behavior:
757-
758-
.. code-block:: ipython
759-
760-
In [4]: (res1, res2) = s1.align(s2, join='inner')
761-
762-
In [5]: res1
763-
Out[5]:
764-
1 10
765-
2 20
766-
dtype: int64
767-
768-
In [6]: res2
769-
Out[6]:
770-
1 100
771-
2 200
772-
dtype: int64
773-
774-
New Behavior:
775-
776-
.. ipython:: python
777-
778-
(res1, res2) = s1.align(s2, join='inner')
779-
res1
780-
res2
781-
782-
- ``DataFrame.join``, ``DataFrame.merge`` and ``pd.merge``
740+
- ``DataFrame.join`` and ``pd.merge``
783741

784742
.. ipython:: python
785743

@@ -798,41 +756,18 @@ joins (methods ``Index.join``, ``DataFrame.join``, ``DataFrame.merge`` and
798756
1 10 100
799757
2 20 200
800758

801-
In [5]: df1.merge(df2, how='inner', left_index=True, right_index=True)
759+
In [5]: pd.merge(df1, df2, how='inner', left_index=True, right_index=True)
802760
Out[5]:
803761
a b
804762
1 10 100
805763
2 20 200
806764

807-
In [6]: pd.merge(df1, df2, how='inner', left_index=True, right_index=True)
808-
Out[6]:
809-
a b
810-
1 10 100
811-
2 20 200
812-
813-
In [7]: (res1, res2) = df1.align(df2, axis=0, join='inner')
814-
815-
In [8]: res1
816-
Out[8]:
817-
a
818-
1 10
819-
2 20
820-
821-
In [9]: res2
822-
Out[9]:
823-
b
824-
1 100
825-
2 200
826-
827765
New Behavior:
828766

829767
.. ipython:: python
830768

831769
df1.join(df2, how='inner')
832-
df1.merge(df2, how='inner', left_index=True, right_index=True)
833-
(res1, res2) = df1.align(df2, axis=0, join='inner')
834-
res1
835-
res2
770+
pd.merge(df1, df2, how='inner', left_index=True, right_index=True)
836771

837772

838773
.. _whatsnew_0200.api:
@@ -1055,4 +990,4 @@ Bug Fixes
1055990
- Bug in ``pd.melt()`` where passing a tuple value for ``value_vars`` caused a ``TypeError`` (:issue:`15348`)
1056991
- Bug in ``.eval()`` which caused multiline evals to fail with local variables not on the first line (:issue:`15342`)
1057992
- Bug in ``pd.read_msgpack`` which did not allow to load dataframe with an index of type ``CategoricalIndex`` (:issue:`15487`)
1058-
- Bug with ``sort=True`` in ``DataFrame.join``, ``DataFrame.merge`` and ``pd.merge`` when joining on index (:issue:`15582`)
993+
- 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)