daft.Expression.str.repeat

daft.Expression.str.repeat#

Expression.str.repeat(n: int | daft.expressions.expressions.Expression) Expression[source]#

Repeats each string n times

Example

>>> import daft
>>> df = daft.from_pydict({"x": ["daft", "query", "engine"]})
>>> df = df.select(df["x"].str.repeat(5))
>>> df.show()
╭────────────────────────────────╮
│ x                              │
│ ---                            │
│ Utf8                           │
╞════════════════════════════════╡
│ daftdaftdaftdaftdaft           │
├╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌┤
│ queryqueryqueryqueryquery      │
├╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌┤
│ engineengineengineengineengin… │
╰────────────────────────────────╯

(Showing first 3 of 3 rows)
Returns:

a String expression which is self repeated n times

Return type:

Expression