Skip to content

daft.functions.is_inf#

is_inf #

is_inf(expr: Expression) -> Expression

Checks if values in the Expression are Infinity.

Returns:

Name Type Description
Expression Expression

Boolean Expression indicating whether values are Infinity.

Note

Nulls will be propagated! I.e. this operation will return a null for null values.

Examples:

1
2
3
4
5
6
>>> import daft
>>> from daft.functions import is_inf
>>>
>>> df = daft.from_pydict({"data": [-float("inf"), 0.0, float("inf"), None]})
>>> df = df.select(is_inf(df["data"]))
>>> df.collect()
╭───────╮
│ data  │
│ ---   │
│ Bool  │
╞═══════╡
│ true  │
├╌╌╌╌╌╌╌┤
│ false │
├╌╌╌╌╌╌╌┤
│ true  │
├╌╌╌╌╌╌╌┤
│ None  │
╰───────╯
(Showing first 4 of 4 rows)
Source code in daft/functions/numeric.py
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
def is_inf(expr: Expression) -> Expression:
    """Checks if values in the Expression are Infinity.

    Returns:
        Expression: Boolean Expression indicating whether values are Infinity.

    Note:
        Nulls will be propagated! I.e. this operation will return a null for null values.

    Examples:
        >>> import daft
        >>> from daft.functions import is_inf
        >>>
        >>> df = daft.from_pydict({"data": [-float("inf"), 0.0, float("inf"), None]})
        >>> df = df.select(is_inf(df["data"]))
        >>> df.collect()
        ╭───────╮
        │ data  │
        │ ---   │
        │ Bool  │
        ╞═══════╡
        │ true  │
        ├╌╌╌╌╌╌╌┤
        │ false │
        ├╌╌╌╌╌╌╌┤
        │ true  │
        ├╌╌╌╌╌╌╌┤
        │ None  │
        ╰───────╯
        <BLANKLINE>
        (Showing first 4 of 4 rows)

    """
    return Expression._call_builtin_scalar_fn("is_inf", expr)