Convert a String Series into a Decimal Series
Description
Usage
series_str_to_decimal(..., scale = NULL, inference_length = 100L)
Arguments
…
|
These dots are for future extensions and must be empty. |
scale
|
Number of digits after the comma to use for the decimals, or
NULL (default). If NULL , the method will infer
the scale from the data.
|
inference_length
|
Number of elements to parse to determine the precision and
scale of the decimal data type.
|
Value
A polars Series
See Also
-
\
$str$to_decimal()
Examples
library("polars")
s <- as_polars_series(c(
"40.12",
"3420.13",
"120134.19",
"3212.98",
"12.90",
"143.09",
"143.9"
))
s$str$to_decimal()
#> shape: (7, 1)
#> ┌──────────────┐
#> │ │
#> │ --- │
#> │ decimal[*,2] │
#> ╞══════════════╡
#> │ 40.12 │
#> │ 3420.13 │
#> │ 120134.19 │
#> │ 3212.98 │
#> │ 12.90 │
#> │ 143.09 │
#> │ 143.90 │
#> └──────────────┘
#> shape: (7, 1)
#> ┌──────────────┐
#> │ │
#> │ --- │
#> │ decimal[*,4] │
#> ╞══════════════╡
#> │ 40.1200 │
#> │ 3420.1300 │
#> │ 120134.1900 │
#> │ 3212.9800 │
#> │ 12.9000 │
#> │ 143.0900 │
#> │ 143.9000 │
#> └──────────────┘