polars integer

For dataframe.

Converts a string column into a integer column

warning This command requires a plugin The polars integer command resides in the polars plugin. To use this command, you must install and register nu_plugin_polars. See the Plugins chapter in the book for more information.

Command Type

plugin

Signature

> polars integer {flags} (base) (dtype)

Flags

  • --strict, -s: Raises an error as opposed to converting to null.

Parameters

  • base: An integer or expression representing the base (radix) of the number system (default is 10).
  • dtype: Data type to cast to (defaults is i64).

Input/output types:

input output
polars_expression polars_expression
polars_selector polars_expression

Examples

Modifies strings to integer

> [[a b]; [1, '2']] | polars into-df | polars select (polars col b | polars integer) | polars collect
╭───┬───╮
│ # │ b │
├───┼───┤
│ 0 │ 2 │
╰───┴───╯

Ported from nushell/nushell.github.io. Copyright (c) 2021 Nushell Project. MIT License.