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
Here's a description of what each argument is for:
514
514
@@ -539,6 +539,15 @@ Here's a description of what each argument is for:
539
539
cases but may improve performance / memory usage. The cases where copying
540
540
can be avoided are somewhat pathological but this option is provided
541
541
nonetheless.
542
+
- ``indicator``: Add a column to the output DataFrame called ``_merge``
543
+
with information on the source of each row. ``_merge`` is Categorical-type
544
+
and takes on a value of ``left_only`` for observations whose merge key
545
+
only appears in ``'left'`` DataFrame, ``right_only`` for observations whose
546
+
merge key only appears in ``'right'`` DataFrame, and ``both`` if the
547
+
observation's merge key is found in both.
548
+
549
+
.. versionadded:: 0.17.0
550
+
542
551
543
552
The return type will be the same as ``left``. If ``left`` is a ``DataFrame``
544
553
and ``right`` is a subclass of DataFrame, the return type will still be
@@ -684,6 +693,36 @@ either the left or right tables, the values in the joined table will be
684
693
labels=['left', 'right'], vertical=False);
685
694
plt.close('all');
686
695
696
+
.. _merging.indicator:
697
+
698
+
The merge indicator
699
+
~~~~~~~~~~~~~~~~~~~
700
+
701
+
.. versionadded:: 0.17.0
702
+
703
+
``merge`` now accepts the argument ``indicator``. If ``True``, a Categorical-type column called ``_merge`` will be added to the output object that takes on values:
The ``indicator`` argument will also accept string arguments, in which case the indicator function will use the value of the passed string as the name for the indicator column.
Copy file name to clipboardExpand all lines: doc/source/whatsnew/v0.17.0.txt
+21
Original file line number
Diff line number
Diff line change
@@ -51,6 +51,27 @@ Check the :ref:`API Changes <whatsnew_0170.api>` and :ref:`deprecations <whatsne
51
51
New features
52
52
~~~~~~~~~~~~
53
53
54
+
- ``merge`` now accepts the argument ``indicator`` which adds a Categorical-type column (by default called ``_merge``) to the output object that takes on the values:
0 commit comments