cudf.core.column.string.StringMethods.detokenize#

StringMethods.detokenize(indices: cudf.Series, separator: str = ' ') SeriesOrIndex[source]#

Combines tokens into strings by concatenating them in the order in which they appear in the indices column. The separator is concatenated between each token.

Parameters:
indicesSeries

Each value identifies the output row for the corresponding token.

separatorstr

The string concatenated between each token in an output row. Default is space.

Returns:
Series or Index of object.

Examples

>>> import cudf
>>> strs = cudf.Series(["hello", "world", "one", "two", "three"])
>>> indices = cudf.Series([0, 0, 1, 1, 2])
>>> strs.str.detokenize(indices)
0    hello world
1        one two
2          three
dtype: object