transform#
- pylibcudf.transform.bools_to_mask(
- Column input,
- stream=None,
- DeviceMemoryResource mr=None,
Create a bitmask from a column of boolean elements
- Parameters:
- inputColumn
Column to produce new mask from.
- streamStream | None
CUDA stream on which to perform the operation.
- mrDeviceMemoryResource | None
Device memory resource used to allocate the returned mask’s device memory.
- Returns:
- tuple[gpumemoryview, int]
Two-tuple of a gpumemoryview wrapping the bitmask and the null count.
- pylibcudf.transform.column_nans_to_nulls(
- Column input,
- stream=None,
- DeviceMemoryResource mr=None,
Create a column with nans converted to nulls.
For details, see
column_nans_to_nulls().- Parameters:
- inputColumn
Column to convert nans to nulls.
- streamStream | None
CUDA stream on which to perform the operation.
- mrDeviceMemoryResource | None
Device memory resource used to allocate the returned column’s device memory.
- Returns:
- Column
New column with nans converted to nulls.
- pylibcudf.transform.compute_column(
- Table input,
- Expression expr,
- stream=None,
- DeviceMemoryResource mr=None,
Create a column by evaluating an expression on a table.
For details see
compute_column().- Parameters:
- inputTable
Table used for expression evaluation
- exprExpression
Expression to evaluate
- streamStream | None
CUDA stream on which to perform the operation.
- mrDeviceMemoryResource | None
Device memory resource used to allocate the returned column’s device memory.
- Returns:
- Column of the evaluated expression
- pylibcudf.transform.compute_column_jit(
- Table input,
- Expression expr,
- stream=None,
- DeviceMemoryResource mr=None,
Create a column by evaluating an expression on a table using a JIT-compiled kernel.
For details see
compute_column_jit().- Parameters:
- inputTable
Table used for expression evaluation
- exprExpression
Expression to evaluate
- streamStream | None
CUDA stream on which to perform the operation.
- mrDeviceMemoryResource | None
Device memory resource used to allocate the returned column’s device memory.
- Returns:
- Column of the evaluated expression
- pylibcudf.transform.encode(
- Table input,
- stream=None,
- DeviceMemoryResource mr=None,
Encode the rows of the given table as integers.
- Parameters:
- inputTable
Table containing values to be encoded
- streamStream | None
CUDA stream on which to perform the operation.
- mrDeviceMemoryResource | None
Device memory resource used to allocate the returned objects’ device memory.
- Returns:
- tuple[Table, Column]
The distinct row of the input table in sorted order, and a column of integer indices representing the encoded rows.
- pylibcudf.transform.mask_to_bools(
- Py_ssize_t bitmask,
- int begin_bit,
- int end_bit,
- stream=None,
- DeviceMemoryResource mr=None,
Creates a boolean column from given bitmask.
- Parameters:
- bitmaskint
Pointer to the bitmask which needs to be converted
- begin_bitint
Position of the bit from which the conversion should start
- end_bitint
Position of the bit before which the conversion should stop
- streamStream | None
CUDA stream on which to perform the operation.
- mrDeviceMemoryResource | None
Device memory resource used to allocate the returned column’s device memory.
- Returns:
- Column
Boolean column of the bitmask from [begin_bit, end_bit]
- pylibcudf.transform.nans_to_nulls(
- Column input,
- stream=None,
- DeviceMemoryResource mr=None,
Create a null mask preserving existing nulls and converting nans to null.
For details, see
nans_to_nulls().- Parameters:
- inputColumn
Column to produce new mask from.
- streamStream | None
CUDA stream on which to perform the operation.
- mrDeviceMemoryResource | None
Device memory resource used to allocate the returned mask’s device memory.
- Returns:
- Two-tuple of a gpumemoryview wrapping the null mask and the new null count.
- pylibcudf.transform.one_hot_encode(
- Column input,
- Column categories,
- stream=None,
- DeviceMemoryResource mr=None,
Encodes input by generating a new column for each value in categories indicating the presence of that value in input.
- Parameters:
- inputColumn
Column containing values to be encoded.
- categoriesColumn
Column containing categories
- streamStream | None
CUDA stream on which to perform the operation.
- mrDeviceMemoryResource | None
Device memory resource used to allocate the returned table’s device memory.
- Returns:
- Column
A table of the encoded values.
- pylibcudf.transform.transform(
- inputs,
- str transform_udf,
- DataType output_type,
- bool is_ptx,
- null_aware is_null_aware,
- output_nullability null_policy,
- stream=None,
- DeviceMemoryResource mr=None,
- Create a new column by applying a transform function against
multiple input columns.
- Parameters:
- inputsSequence[Column]
Columns to transform.
- transform_udfstr
The PTX/CUDA string of the transform function to apply.
- output_typeDataType
The output type that is compatible with the output type in the unary_udf.
- is_ptxbool
If True, the UDF is treated as PTX code. If False, the UDF is treated as CUDA code.
- is_null_aware: NullAware
If NO, the UDF gets non-nullable parameters If YES, the UDF gets nullable parameters
- null_policy: OutputNullability
If PRESERVE, null-masks are produced if necessary. If ALL_VALID, null-masks are not produced. ALL_VALID has undefined behavior if the UDF can produce nulls.
- streamStream | None
CUDA stream on which to perform the operation.
- mrDeviceMemoryResource | None
Device memory resource used to allocate the returned column’s device memory.
- Returns:
- Column
The transformed column having the UDF applied to each element.