replace#
- cudf._lib.pylibcudf.replace.clamp(Column source_column, Scalar lo, Scalar hi, Scalar lo_replace=None, Scalar hi_replace=None) Column #
Clamp the values in source_column to the range [lo, hi].
For details, see
clamp()
.- Parameters:
- source_columnColumn
The column to clamp.
- loScalar
The lower bound of the clamp range.
- hiScalar
The upper bound of the clamp range.
- lo_replaceScalar, optional
The value to use for elements that are less than lo. If not specified, the value of lo is used.
- hi_replaceScalar, optional
The value to use for elements that are greater than hi. If not specified, the value of hi is used.
- Returns:
- Column
A copy of source_column with values clamped to the range [lo, hi].
- cudf._lib.pylibcudf.replace.find_and_replace_all(Column source_column, Column values_to_replace, Column replacement_values) Column #
Replace all occurrences of values_to_replace with replacement_values.
For details, see
find_and_replace_all()
.- Parameters:
- source_columnColumn
The column in which to replace values.
- values_to_replaceColumn
The column containing values to replace.
- replacement_valuesColumn
The column containing replacement values.
- Returns:
- Column
A copy of source_column with all occurrences of values_to_replace replaced by replacement_values.
- cudf._lib.pylibcudf.replace.normalize_nans_and_zeros(Column source_column, bool inplace=False) Column #
Normalize NaNs and zeros in source_column.
For details, see
normalize_nans_and_zeros()
.- Parameters:
- source_columnColumn
The column to normalize.
- inplacebool, optional
If True, normalize source_column in place. If False, return a new column with the normalized values.
- Returns:
- Column
A copy of source_column with NaNs and zeros normalized.
- cudf._lib.pylibcudf.replace.replace_nulls(signatures, args, kwargs, defaults, _fused_sigindex={})#
Replace nulls in source_column.
- The values used to replace nulls depends on the type of replacement:
If replacement is a Column, the corresponding value from replacement is used.
If replacement is a Scalar, the same value is used for all nulls.
If replacement is a replace_policy, the policy is used to determine the replacement value:
PRECEDING: The first non-null value that precedes the null is used.
FOLLOWING: The first non-null value that follows the null is used.
For more details, see
replace_nulls()
.- Parameters:
- source_columnColumn
The column in which to replace nulls.
- replacement_columnUnion[Column, Scalar, replace_policy]
If a Column, the values to use as replacements. If a Scalar, the value to use as a replacement. If a replace_policy, the policy to use to determine the replacement value.
- Returns:
- Column
A copy of source_column with nulls replaced by values from replacement_column.