Skip to content

Commit 32eeb33

Browse files
h-vetinariPingviinituutti
authored andcommitted
DOC: update str.cat example (pandas-dev#23723)
1 parent f597a88 commit 32eeb33

File tree

1 file changed

+7
-6
lines changed

1 file changed

+7
-6
lines changed

doc/source/text.rst

+7-6
Original file line numberDiff line numberDiff line change
@@ -303,23 +303,24 @@ The same alignment can be used when ``others`` is a ``DataFrame``:
303303
Concatenating a Series and many objects into a Series
304304
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
305305

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

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

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

325326
.. ipython:: python

0 commit comments

Comments
 (0)