daft.Expression.str.length_bytes

daft.Expression.str.length_bytes#

Expression.str.length_bytes() Expression[source]#

Retrieves the length for a UTF-8 string column in bytes.

Example

>>> import daft
>>> df = daft.from_pydict({"x": ["๐Ÿ˜‰test", "heyฬ†", "baz"]})
>>> df = df.select(df["x"].str.length_bytes())
>>> df.show()
โ•ญโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ•ฎ
โ”‚ x      โ”‚
โ”‚ ---    โ”‚
โ”‚ UInt64 โ”‚
โ•žโ•โ•โ•โ•โ•โ•โ•โ•โ•ก
โ”‚ 8      โ”‚
โ”œโ•Œโ•Œโ•Œโ•Œโ•Œโ•Œโ•Œโ•Œโ”ค
โ”‚ 5      โ”‚
โ”œโ•Œโ•Œโ•Œโ•Œโ•Œโ•Œโ•Œโ•Œโ”ค
โ”‚ 3      โ”‚
โ•ฐโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ•ฏ

(Showing first 3 of 3 rows)
Returns:

an UInt64 expression with the length of each string

Return type:

Expression