Checks if values in the Expression are Null (a special value indicating missing data).
Returns:
| Name | Type | Description |
Expression | Boolean Expression | expression indicating whether values are missing |
Examples:
| >>> import daft
>>> from daft.functions import is_null
>>>
>>> df = daft.from_pydict({"x": [1.0, None, float("nan")]})
>>> df = df.select(is_null(df["x"]))
>>> df.collect()
|
╭───────╮
│ x │
│ --- │
│ Bool │
╞═══════╡
│ false │
├╌╌╌╌╌╌╌┤
│ true │
├╌╌╌╌╌╌╌┤
│ false │
╰───────╯
(Showing first 3 of 3 rows)
Source code in daft/functions/misc.py
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271 | def is_null(expr: Expression) -> Expression:
"""Checks if values in the Expression are Null (a special value indicating missing data).
Returns:
Expression (Boolean Expression): expression indicating whether values are missing
Examples:
>>> import daft
>>> from daft.functions import is_null
>>>
>>> df = daft.from_pydict({"x": [1.0, None, float("nan")]})
>>> df = df.select(is_null(df["x"]))
>>> df.collect()
╭───────╮
│ x │
│ --- │
│ Bool │
╞═══════╡
│ false │
├╌╌╌╌╌╌╌┤
│ true │
├╌╌╌╌╌╌╌┤
│ false │
╰───────╯
<BLANKLINE>
(Showing first 3 of 3 rows)
"""
expr = Expression._to_expression(expr)
return Expression._from_pyexpr(expr._expr.is_null())
|