polars str-lengths for dataframe
Get lengths of all strings.
Signature
> polars str-lengths {flags}
Flags
-
--bytes, -b: Get the length in bytes instead of chars.
Input/output types:
| input | output |
|---|---|
| polars_expression | polars_expression |
| polars_dataframe | polars_dataframe |
| polars_lazyframe | polars_lazyframe |
Examples
Returns string lengths for a column
> [[a]; [a] [ab] [abc]] | polars into-df | polars select (polars col a | polars str-lengths) | polars collect ╭───┬───╮ │ # │ a │ ├───┼───┤ │ 0 │ 1 │ │ 1 │ 2 │ │ 2 │ 3 │ ╰───┴───╯
Returns string lengths
> [a ab abc] | polars into-df | polars str-lengths ╭───┬───╮ │ # │ 0 │ ├───┼───┤ │ 0 │ 1 │ │ 1 │ 2 │ │ 2 │ 3 │ ╰───┴───╯
Copyright © 2019–2026 The Nushell Project DevelopersLicensed under the MIT License.
https://www.nushell.sh/commands/docs/polars_str-lengths.html