Skip to content

daft.functions.is_null#

is_null #

is_null(expr: Expression) -> Expression

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:

1
2
3
4
5
6
>>> 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
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
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())