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
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
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)