replace#

cudf._lib.pylibcudf.strings.replace.replace(Column input, Scalar target, Scalar repl, size_type maxrepl=-1) Column#

Replaces target string within each string with the specified replacement string.

Null string entries will return null output string entries.

For details, see replace().

Parameters:
inputColumn

The input strings

targetScalar

String to search for in each string.

replScalar

String to replace target with.

maxreplsize_type, default -1

Maximum times to replace if target appears multiple times in the input string. Default of -1 specifies to replace all occurrences of target in each string.

Returns:
pylibcudf.Column

New string column with target replaced.

cudf._lib.pylibcudf.strings.replace.replace_multiple(Column input, Column target, Column repl, size_type maxrepl=-1) Column#

Replaces target string within each string with the specified replacement string.

Null string entries will return null output string entries.

For details, see replace_multiple().

Parameters:
inputColumn

The input strings

targetColumn

Column containing strings to search for in the input column.

replColumn

Column containing strings to replace target with. Each target, when found, will be replaced by the value at the corresponding index in the repl Column.

Must be of the same length as target.

Returns:
pylibcudf.Column

New string column with target replaced.

cudf._lib.pylibcudf.strings.replace.replace_slice(Column input, Scalar repl=None, size_type start=0, size_type stop=-1) Column#

Replaces each string in the column with the provided repl string within the [start,stop) character position range.

Null string entries will return null output string entries. This function can be used to insert a string into specific position by specifying the same position value for start and stop. The repl string can be appended to each string by specifying -1 for both start and stop.

For details, see replace_slice().

Parameters:
inputColumn

The input strings

replScalar, default “”

String scalar to replace target with.

startsize_type, default 0

Start position where repl will be added.

stopsize_type, default -1

End position (exclusive) to use for replacement.

Returns
——-
pylibcudf.Column

New string column