@@ -308,7 +308,6 @@ Other enhancements
308
308
- ``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.
309
309
- ``pandas.io.json.json_normalize()`` with an empty ``list`` will return an empty ``DataFrame`` (:issue:`15534`)
310
310
- ``pd.DataFrame.to_latex`` and ``pd.DataFrame.to_string`` now allow optional header aliases. (:issue:`15536`)
311
- - ``Index.join()`` accepts parameter ``sort`` (:issue:`15582`)
312
311
313
312
314
313
.. _ISO 8601 duration: https://en.wikipedia.org/wiki/ISO_8601#Durations
@@ -714,11 +713,9 @@ Index order after inner join due to Index intersection
714
713
715
714
The ``Index.intersection`` now preserves the order of the calling Index (left)
716
715
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.
720
717
721
- - ``Index.intersection`` and ``Index.join``
718
+ - ``Index.intersection``
722
719
723
720
.. ipython:: python
724
721
@@ -734,52 +731,13 @@ joins (methods ``Index.join``, ``DataFrame.join``, ``DataFrame.merge`` and
734
731
In [4]: idx1.intersection(idx2)
735
732
Out[4]: Int64Index([1, 2], dtype='int64')
736
733
737
- In [5]: idx1.join(idx2, how='inner')
738
- Out[5]: Int64Index([1, 2], dtype='int64')
739
-
740
734
New Behavior:
741
735
742
736
.. ipython:: python
743
737
744
738
idx1.intersection(idx2)
745
- idx1.join(idx2, how='inner')
746
739
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``
783
741
784
742
.. ipython:: python
785
743
@@ -798,41 +756,18 @@ joins (methods ``Index.join``, ``DataFrame.join``, ``DataFrame.merge`` and
798
756
1 10 100
799
757
2 20 200
800
758
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)
802
760
Out[5]:
803
761
a b
804
762
1 10 100
805
763
2 20 200
806
764
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
-
827
765
New Behavior:
828
766
829
767
.. ipython:: python
830
768
831
769
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)
836
771
837
772
838
773
.. _whatsnew_0200.api:
@@ -1055,4 +990,4 @@ Bug Fixes
1055
990
- Bug in ``pd.melt()`` where passing a tuple value for ``value_vars`` caused a ``TypeError`` (:issue:`15348`)
1056
991
- Bug in ``.eval()`` which caused multiline evals to fail with local variables not on the first line (:issue:`15342`)
1057
992
- 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`)
0 commit comments