Skip to content

Commit cbe4324

Browse files
feiphoonvictor
authored and
victor
committed
DOC: Update the Series.str.join docstring (pandas-dev#22174)
1 parent d5965ca commit cbe4324

File tree

1 file changed

+11
-5
lines changed

1 file changed

+11
-5
lines changed

pandas/core/strings.py

+11-5
Original file line numberDiff line numberDiff line change
@@ -1108,10 +1108,17 @@ def str_join(arr, sep):
11081108
Returns
11091109
-------
11101110
Series/Index: object
1111+
The list entries concatenated by intervening occurrences of the
1112+
delimiter.
1113+
1114+
Raises
1115+
-------
1116+
AttributeError
1117+
If the supplied Series contains neither strings nor lists.
11111118
11121119
Notes
11131120
-----
1114-
If any of the lists does not contain string objects the result of the join
1121+
If any of the list items is not a string object, the result of the join
11151122
will be `NaN`.
11161123
11171124
See Also
@@ -1121,13 +1128,12 @@ def str_join(arr, sep):
11211128
11221129
Examples
11231130
--------
1124-
11251131
Example with a list that contains non-string elements.
11261132
11271133
>>> s = pd.Series([['lion', 'elephant', 'zebra'],
11281134
... [1.1, 2.2, 3.3],
11291135
... ['cat', np.nan, 'dog'],
1130-
... ['cow', 4.5, 'goat']
1136+
... ['cow', 4.5, 'goat'],
11311137
... ['duck', ['swan', 'fish'], 'guppy']])
11321138
>>> s
11331139
0 [lion, elephant, zebra]
@@ -1137,8 +1143,8 @@ def str_join(arr, sep):
11371143
4 [duck, [swan, fish], guppy]
11381144
dtype: object
11391145
1140-
Join all lists using an '-', the lists containing object(s) of types other
1141-
than str will become a NaN.
1146+
Join all lists using a '-'. The lists containing object(s) of types other
1147+
than str will produce a NaN.
11421148
11431149
>>> s.str.join('-')
11441150
0 lion-elephant-zebra

0 commit comments

Comments
 (0)