Clip (limit) the values in an array to any value that fits in 64 floating point range. Only works for the following dtypes: {Int32, Int64, Float32, Float64, UInt32}. If you want to clip other dtypes, consider writing a when -> then -> otherwise expression
Minimum value
Maximum value
Get the index of the maximal value.
Get the index of the minimal value.
Get the length of each individual chunk
__Quick summary statistics of a series. __
Series with mixed datatypes will return summary statistics for the datatype of the first value.
> const seriesNum = pl.Series([1,2,3,4,5])
> series_num.describe()
shape: (6, 2)
┌──────────────┬────────────────────┐
│ statistic ┆ value │
│ --- ┆ --- │
│ str ┆ f64 │
╞══════════════╪════════════════════╡
│ "min" ┆ 1 │
├╌╌╌╌╌╌╌╌╌╌╌╌╌╌┼╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌┤
│ "max" ┆ 5 │
├╌╌╌╌╌╌╌╌╌╌╌╌╌╌┼╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌┤
│ "null_count" ┆ 0.0 │
├╌╌╌╌╌╌╌╌╌╌╌╌╌╌┼╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌┤
│ "mean" ┆ 3 │
├╌╌╌╌╌╌╌╌╌╌╌╌╌╌┼╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌┤
│ "std" ┆ 1.5811388300841898 │
├╌╌╌╌╌╌╌╌╌╌╌╌╌╌┼╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌┤
│ "count" ┆ 5 │
└──────────────┴────────────────────┘
> series_str = pl.Series(["a", "a", None, "b", "c"])
> series_str.describe()
shape: (3, 2)
┌──────────────┬───────┐
│ statistic ┆ value │
│ --- ┆ --- │
│ str ┆ i64 │
╞══════════════╪═══════╡
│ "unique" ┆ 4 │
├╌╌╌╌╌╌╌╌╌╌╌╌╌╌┼╌╌╌╌╌╌╌┤
│ "null_count" ┆ 1 │
├╌╌╌╌╌╌╌╌╌╌╌╌╌╌┼╌╌╌╌╌╌╌┤
│ "count" ┆ 5 │
└──────────────┴───────┘
Returns True if the Series has a validity bitmask. If there is none, it means that there are no null values.
Interpolate intermediate values.
The interpolation method is linear.
Optional
method: InterpolationMethodCheck if this Series is a Boolean.
Check if this Series is a DataTime.
Check if this Series is a Float.
Check if this Series datatype is numeric.
Checks if this Series datatype is a String.
Compute the kurtosis (Fisher or Pearson) of a dataset.
Kurtosis is the fourth central moment divided by the square of the variance. If Fisher's definition is used, then 3.0 is subtracted from the result to give 0.0 for a normal distribution. If bias is False then the kurtosis is calculated using k statistics to eliminate bias coming from biased moment estimators
Optional
bias: booleanGet the number of chunks that this Series contains.
Count the null values in this Series. --
undefined
values are treated as null
Assign ranks to data, dealing with ties appropriately.
Optional
method: RankMethodThe method used to assign ranks to tied elements.
Optional
descending: booleanRank in descending order.
Compute the sample skewness of a data set.
For normally distributed data, the skewness should be about zero. For
unimodal continuous distributions, a skewness value greater than zero means
that there is more weight in the right tail of the distribution. The
function skewtest
can be used to determine if the skewness value
is close enough to zero, statistically speaking.
Optional
bias: booleanIf false, then the calculations are corrected for statistical bias.
Convert this Series to a Javascript Array.
This operation clones data, and is very slow, but maintains greater precision for all dtypes.
Often times series.toObject().values
is faster, but less precise
Get dummy/indicator variables.
Optional
separator: stringOptional
dropFirst: booleanconst s = pl.Series("a", [1, 2, 3])
>>> s.toDummies()
shape: (3, 3)
┌─────┬─────┬─────┐
│ a_1 ┆ a_2 ┆ a_3 │
│ --- ┆ --- ┆ --- │
│ u8 ┆ u8 ┆ u8 │
╞═════╪═════╪═════╡
│ 1 ┆ 0 ┆ 0 │
│ 0 ┆ 1 ┆ 0 │
│ 0 ┆ 0 ┆ 1 │
└─────┴─────┴─────┘
>>> s.toDummies(":", true)
shape: (3, 2)
┌─────┬─────┐
│ a:2 ┆ a:3 │
│ --- ┆ --- │
│ u8 ┆ u8 │
╞═════╪═════╡
│ 0 ┆ 0 │
│ 1 ┆ 0 │
│ 0 ┆ 1 │
└─────┴─────┘
compat with `JSON.stringify
Converts series to a javascript typedArray.
Warning: This will throw an error if you have nulls, or are using non numeric data types
Count the unique values in a Series.
Optional
sort: booleanSort the output by count in descending order.
If set to False
(default), the order of the output is random.
Optional
parallel: booleanExecute the computation in parallel. .. note:: This option should likely not be enabled in a group by context, as the computation is already parallelized per group.
Optional
name: stringGive the resulting count column a specific name;
if normalize
is True defaults to "count", otherwise defaults to "proportion".
Optional
normalize: booleanIf true gives relative frequencies of the unique values
Returns an iterator over the values
Apply a rolling max (moving max) over the values in this Series.
A window of length window_size
will traverse the series. The values that fill this window
will (optionally) be multiplied with the weights given by the weight
vector.
The resulting parameters' values will be aggregated into their sum.
Apply a rolling mean (moving mean) over the values in this Series.
A window of length window_size
will traverse the series. The values that fill this window
will (optionally) be multiplied with the weights given by the weight
vector.
The resulting parameters' values will be aggregated into their sum.
Apply a rolling min (moving min) over the values in this Series.
A window of length window_size
will traverse the series. The values that fill this window
will (optionally) be multiplied with the weights given by the weight
vector.
The resulting parameters' values will be aggregated into their sum.
Optional
interpolation: InterpolationMethodOptional
windowSize: numberOptional
weights: number[]Optional
minPeriods: number[]Optional
center: booleanOptional
by: stringOptional
closed: ClosedWindowCompute a rolling skew
options for rolling mean operations
Compute a rolling std dev
A window of length window_size
will traverse the array. The values that fill this window
will (optionally) be multiplied with the weights given by the weight
vector. The resulting
values will be aggregated to their sum.
Apply a rolling sum (moving sum) over the values in this Series.
A window of length window_size
will traverse the series. The values that fill this window
will (optionally) be multiplied with the weights given by the weight
vector.
The resulting parameters' values will be aggregated into their sum.
Compute a rolling variance.
A window of length window_size
will traverse the series. The values that fill this window
will (optionally) be multiplied with the weights given by the weight
vector.
The resulting parameters' values will be aggregated into their sum.
A Series represents a single column in a polars DataFrame.