str = None, na_rep: str = None) str#, sep: str = None, na_rep: str = None) Union[SeriesOrIndex, 'cudf.core.column.string.StringColumn']

Concatenate strings in the Series/Index with given separator.

If others is specified, this function concatenates the Series/Index and elements of others element-wise. If others is not passed, then all values in the Series/Index are concatenated into a single string with a given sep.

othersSeries or List of str

Strings to be appended. The number of strings must match size() of this instance. This must be either a Series of string dtype or a Python list of strings.


If specified, this separator will be appended to each string before appending the others.


This character will take the place of any null strings (not empty strings) in either list.

  • If na_rep is None, and others is None, missing values in the Series/Index are omitted from the result.

  • If na_rep is None, and others is not None, a row containing a missing value in any of the columns (before concatenation) will have a missing value in the result.

concatstr or Series/Index of str dtype

If others is None, str is returned, otherwise a Series/Index (same type as caller) of str dtype is returned.


>>> import cudf
>>> s = cudf.Series(['a', 'b', None, 'd'])
>>>' ')
'a b d'

By default, NA values in the Series are ignored. Using na_rep, they can be given a representation:

>>>' ', na_rep='?')
'a b ? d'

If others is specified, corresponding values are concatenated with the separator. Result will be a Series of strings.

>>>['A', 'B', 'C', 'D'], sep=',')
0     a,A
1     b,B
2    <NA>
3     d,D
dtype: object

Missing values will remain missing in the result, but can again be represented using na_rep

>>>['A', 'B', 'C', 'D'], sep=',', na_rep='-')
0    a,A
1    b,B
2    -,C
3    d,D
dtype: object

If sep is not specified, the values are concatenated without separation.

>>>['A', 'B', 'C', 'D'], na_rep='-')
0    aA
1    bB
2    -C
3    dD
dtype: object