@@ -309,7 +309,6 @@ Other enhancements
309
309
- ``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.
310
310
- ``pandas.io.json.json_normalize()`` with an empty ``list`` will return an empty ``DataFrame`` (:issue:`15534`)
311
311
- ``pd.DataFrame.to_latex`` and ``pd.DataFrame.to_string`` now allow optional header aliases. (:issue:`15536`)
312
- - ``Index.join()`` accepts parameter ``sort`` (:issue:`15582`)
313
312
314
313
.. _ISO 8601 duration: https://en.wikipedia.org/wiki/ISO_8601#Durations
315
314
@@ -746,11 +745,9 @@ Index order after inner join due to Index intersection
746
745
747
746
The ``Index.intersection`` now preserves the order of the calling Index (left)
748
747
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.
752
749
753
- - ``Index.intersection`` and ``Index.join``
750
+ - ``Index.intersection``
754
751
755
752
.. ipython:: python
756
753
@@ -766,52 +763,13 @@ joins (methods ``Index.join``, ``DataFrame.join``, ``DataFrame.merge`` and
766
763
In [4]: idx1.intersection(idx2)
767
764
Out[4]: Int64Index([1, 2], dtype='int64')
768
765
769
- In [5]: idx1.join(idx2, how='inner')
770
- Out[5]: Int64Index([1, 2], dtype='int64')
771
-
772
766
New Behavior:
773
767
774
768
.. ipython:: python
775
769
776
770
idx1.intersection(idx2)
777
- idx1.join(idx2, how='inner')
778
771
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``
815
773
816
774
.. ipython:: python
817
775
@@ -830,41 +788,18 @@ joins (methods ``Index.join``, ``DataFrame.join``, ``DataFrame.merge`` and
830
788
1 10 100
831
789
2 20 200
832
790
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)
834
792
Out[5]:
835
793
a b
836
794
1 10 100
837
795
2 20 200
838
796
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
-
859
797
New Behavior:
860
798
861
799
.. ipython:: python
862
800
863
801
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)
868
803
869
804
870
805
.. _whatsnew_0200.api:
@@ -1103,4 +1038,4 @@ Bug Fixes
1103
1038
- Bug in ``pd.melt()`` where passing a tuple value for ``value_vars`` caused a ``TypeError`` (:issue:`15348`)
1104
1039
- Bug in ``.eval()`` which caused multiline evals to fail with local variables not on the first line (:issue:`15342`)
1105
1040
- 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`)
0 commit comments