Skip to content

Commit ac9d5a1

Browse files
committed
Updating documentation
GH21220
1 parent 2ce56e7 commit ac9d5a1

File tree

2 files changed

+21
-19
lines changed

2 files changed

+21
-19
lines changed

doc/source/merging.rst

Lines changed: 17 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -531,40 +531,40 @@ all standard database join operations between ``DataFrame`` objects:
531531
suffixes=('_x', '_y'), copy=True, indicator=False,
532532
validate=None)
533533

534-
- ``left``: A DataFrame object.
535-
- ``right``: Another DataFrame object.
534+
- ``left``: A DataFrame or named Series object.
535+
- ``right``: Another DataFrame or named Series object.
536536
- ``on``: Column or index level names to join on. Must be found in both the left
537-
and right DataFrame objects. If not passed and ``left_index`` and
537+
and right DataFrame and/or Series objects. If not passed and ``left_index`` and
538538
``right_index`` are ``False``, the intersection of the columns in the
539-
DataFrames will be inferred to be the join keys.
540-
- ``left_on``: Columns or index levels from the left DataFrame to use as
539+
DataFrames and/or Series will be inferred to be the join keys.
540+
- ``left_on``: Columns or index levels from the left DataFrame or Series to use as
541541
keys. Can either be column names, index level names, or arrays with length
542-
equal to the length of the DataFrame.
543-
- ``right_on``: Columns or index levels from the right DataFrame to use as
542+
equal to the length of the DataFrame or Series.
543+
- ``right_on``: Columns or index levels from the right DataFrame or Series to use as
544544
keys. Can either be column names, index level names, or arrays with length
545-
equal to the length of the DataFrame.
545+
equal to the length of the DataFrame or Series.
546546
- ``left_index``: If ``True``, use the index (row labels) from the left
547-
DataFrame as its join key(s). In the case of a DataFrame with a MultiIndex
547+
DataFrame or Series as its join key(s). In the case of a DataFrame or Series with a MultiIndex
548548
(hierarchical), the number of levels must match the number of join keys
549-
from the right DataFrame.
550-
- ``right_index``: Same usage as ``left_index`` for the right DataFrame
549+
from the right DataFrame or Series.
550+
- ``right_index``: Same usage as ``left_index`` for the right DataFrame or Series
551551
- ``how``: One of ``'left'``, ``'right'``, ``'outer'``, ``'inner'``. Defaults
552552
to ``inner``. See below for more detailed description of each method.
553553
- ``sort``: Sort the result DataFrame by the join keys in lexicographical
554554
order. Defaults to ``True``, setting to ``False`` will improve performance
555555
substantially in many cases.
556556
- ``suffixes``: A tuple of string suffixes to apply to overlapping
557557
columns. Defaults to ``('_x', '_y')``.
558-
- ``copy``: Always copy data (default ``True``) from the passed DataFrame
558+
- ``copy``: Always copy data (default ``True``) from the passed DataFrame or named Series
559559
objects, even when reindexing is not necessary. Cannot be avoided in many
560560
cases but may improve performance / memory usage. The cases where copying
561561
can be avoided are somewhat pathological but this option is provided
562562
nonetheless.
563563
- ``indicator``: Add a column to the output DataFrame called ``_merge``
564564
with information on the source of each row. ``_merge`` is Categorical-type
565565
and takes on a value of ``left_only`` for observations whose merge key
566-
only appears in ``'left'`` DataFrame, ``right_only`` for observations whose
567-
merge key only appears in ``'right'`` DataFrame, and ``both`` if the
566+
only appears in ``'left'`` DataFrame or Series, ``right_only`` for observations whose
567+
merge key only appears in ``'right'`` DataFrame or Series, and ``both`` if the
568568
observation's merge key is found in both.
569569

570570
- ``validate`` : string, default None.
@@ -584,9 +584,10 @@ all standard database join operations between ``DataFrame`` objects:
584584

585585
Support for specifying index levels as the ``on``, ``left_on``, and
586586
``right_on`` parameters was added in version 0.23.0.
587+
Support for merging named ``Series`` objects was added in version 0.24.0.
587588

588-
The return type will be the same as ``left``. If ``left`` is a ``DataFrame``
589-
and ``right`` is a subclass of DataFrame, the return type will still be
589+
The return type will be the same as ``left``. If ``left`` is a ``DataFrame`` or named ``Series``
590+
and ``right`` is a subclass of ``DataFrame``, the return type will still be
590591
``DataFrame``.
591592

592593
``merge`` is a function in the pandas namespace, and it is also available as a

pandas/core/frame.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -135,16 +135,16 @@
135135
"""
136136

137137
_merge_doc = """
138-
Merge DataFrame objects by performing a database-style join operation by
139-
columns or indexes.
138+
Merge DataFrame or named Series objects by performing a database-style join
139+
operation by columns or indexes.
140140
141141
If joining columns on columns, the DataFrame indexes *will be
142142
ignored*. Otherwise if joining indexes on indexes or indexes on a column or
143143
columns, the index will be passed on.
144144
145145
Parameters
146146
----------%s
147-
right : DataFrame
147+
right : DataFrame or named Series
148148
how : {'left', 'right', 'outer', 'inner'}, default 'inner'
149149
* left: use only keys from left frame, similar to a SQL left outer join;
150150
preserve key order
@@ -208,6 +208,7 @@
208208
-----
209209
Support for specifying index levels as the `on`, `left_on`, and
210210
`right_on` parameters was added in version 0.23.0
211+
Support for merging named Series objects was added in version 0.24.0
211212
212213
Examples
213214
--------

0 commit comments

Comments
 (0)