join(sep: str) → ps.Series¶
Join lists contained as elements in the Series with passed delimiter.
If the elements of a Series are lists themselves, join the content of these lists using the delimiter passed to the function. This function is an equivalent to calling
str.join()on the lists.
Delimiter to use between list entries.
- Series of object
Series with list entries concatenated by intervening occurrences of the delimiter.
Example with a list that contains a None element.
>>> s = ps.Series([['lion', 'elephant', 'zebra'], ... ['cat', None, 'dog']]) >>> s 0 [lion, elephant, zebra] 1 [cat, None, dog] dtype: object
Join all lists using a ‘-‘. The list containing None will produce None.
>>> s.str.join('-') 0 lion-elephant-zebra 1 None dtype: object