@@ -1108,10 +1108,17 @@ def str_join(arr, sep):
1108
1108
Returns
1109
1109
-------
1110
1110
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.
1111
1118
1112
1119
Notes
1113
1120
-----
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
1115
1122
will be `NaN`.
1116
1123
1117
1124
See Also
@@ -1121,13 +1128,12 @@ def str_join(arr, sep):
1121
1128
1122
1129
Examples
1123
1130
--------
1124
-
1125
1131
Example with a list that contains non-string elements.
1126
1132
1127
1133
>>> s = pd.Series([['lion', 'elephant', 'zebra'],
1128
1134
... [1.1, 2.2, 3.3],
1129
1135
... ['cat', np.nan, 'dog'],
1130
- ... ['cow', 4.5, 'goat']
1136
+ ... ['cow', 4.5, 'goat'],
1131
1137
... ['duck', ['swan', 'fish'], 'guppy']])
1132
1138
>>> s
1133
1139
0 [lion, elephant, zebra]
@@ -1137,8 +1143,8 @@ def str_join(arr, sep):
1137
1143
4 [duck, [swan, fish], guppy]
1138
1144
dtype: object
1139
1145
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.
1142
1148
1143
1149
>>> s.str.join('-')
1144
1150
0 lion-elephant-zebra
0 commit comments