Scalar#

class pylibcudf.scalar.Scalar(*args, **kwargs)#

A scalar value in device memory.

This is the Cython representation of cudf::scalar.

Methods

from_numpy(cls, np_val)

Convert a NumPy scalar to a Scalar.

from_py(cls, py_val[, dtype])

Convert a Python standard library object to a Scalar.

is_valid(self)

True if the scalar is valid, false if not

type(self)

The type of data in the column.

classmethod from_numpy(cls, np_val)#

Convert a NumPy scalar to a Scalar.

Parameters:
np_val: numpy.generic

Value to convert to a pylibcudf.Scalar

Returns:
Scalar

New pylibcudf.Scalar

classmethod from_py(cls, py_val, dtype: DataType | None = None)#

Convert a Python standard library object to a Scalar.

Parameters:
py_val: bool, int, float, str, datetime.datetime, datetime.timedelta, list, dict

Value to convert to a pylibcudf.Scalar

dtype: DataType | None

The datatype to cast the value to. If None, the type is inferred from py_val.

Returns:
Scalar

New pylibcudf.Scalar

is_valid(self) bool#

True if the scalar is valid, false if not

type(self) DataType#

The type of data in the column.