Skip to content

Commit

Permalink
DOC: update str.cat example (#23723)
Browse files Browse the repository at this point in the history
  • Loading branch information
h-vetinari authored and jreback committed Jan 4, 2019
1 parent 2d60af2 commit 25c1c38
Showing 1 changed file with 7 additions and 6 deletions.
13 changes: 7 additions & 6 deletions doc/source/text.rst
Original file line number Diff line number Diff line change
Expand Up @@ -303,23 +303,24 @@ The same alignment can be used when ``others`` is a ``DataFrame``:
Concatenating a Series and many objects into a Series
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

All one-dimensional list-likes can be combined in a list-like container (including iterators, ``dict``-views, etc.):
Several array-like items (specifically: ``Series``, ``Index``, and 1-dimensional variants of ``np.ndarray``)
can be combined in a list-like container (including iterators, ``dict``-views, etc.).

.. ipython:: python
s
u
s.str.cat([u.array,
u.index.astype(str).array], na_rep='-')
s.str.cat([u, u.to_numpy()], join='left')
All elements must match in length to the calling ``Series`` (or ``Index``), except those having an index if ``join`` is not None:
All elements without an index (e.g. ``np.ndarray``) within the passed list-like must match in length to the calling ``Series`` (or ``Index``),
but ``Series`` and ``Index`` may have arbitrary length (as long as alignment is not disabled with ``join=None``):

.. ipython:: python
v
s.str.cat([u, v], join='outer', na_rep='-')
s.str.cat([v, u, u.to_numpy()], join='outer', na_rep='-')
If using ``join='right'`` on a list of ``others`` that contains different indexes,
If using ``join='right'`` on a list-like of ``others`` that contains different indexes,
the union of these indexes will be used as the basis for the final concatenation:

.. ipython:: python
Expand Down

0 comments on commit 25c1c38

Please sign in to comment.