Skip to content

daft.functions.upper#

upper #

upper(expr: Expression) -> Expression

Convert UTF-8 string to all upper.

Returns:

Name Type Description
Expression Expression

a String expression which is self uppercased

Examples:

1
2
3
4
5
>>> import daft
>>> from daft.functions import upper
>>> df = daft.from_pydict({"x": ["foo", "bar", "baz"]})
>>> df = df.select(upper(df["x"]))
>>> df.show()
╭────────╮
│ x      │
│ ---    │
│ String │
╞════════╡
│ FOO    │
├╌╌╌╌╌╌╌╌┤
│ BAR    │
├╌╌╌╌╌╌╌╌┤
│ BAZ    │
╰────────╯
(Showing first 3 of 3 rows)
Source code in daft/functions/str.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
def upper(expr: Expression) -> Expression:
    """Convert UTF-8 string to all upper.

    Returns:
        Expression: a String expression which is `self` uppercased

    Examples:
        >>> import daft
        >>> from daft.functions import upper
        >>> df = daft.from_pydict({"x": ["foo", "bar", "baz"]})
        >>> df = df.select(upper(df["x"]))
        >>> df.show()
        ╭────────╮
        │ x      │
        │ ---    │
        │ String │
        ╞════════╡
        │ FOO    │
        ├╌╌╌╌╌╌╌╌┤
        │ BAR    │
        ├╌╌╌╌╌╌╌╌┤
        │ BAZ    │
        ╰────────╯
        <BLANKLINE>
        (Showing first 3 of 3 rows)

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