Skip to content

Modulo Series

Source code

Description

Method equivalent of modulo operator series %% other.

Usage

<Series>$mod(other)

Arguments

other Series like object of numeric. Converted to Series by as_polars_series() in this method.

Value

Series

See Also

  • Arithmetic operators

Examples

library("polars")

as_polars_series(1:4)$mod(2L)
#> polars Series: shape: (4,)
#> Series: '' [i32]
#> [
#>  1
#>  0
#>  1
#>  0
#> ]
as_polars_series(1:3)$mod(as_polars_series(11:13))
#> polars Series: shape: (3,)
#> Series: '' [i32]
#> [
#>  1
#>  2
#>  3
#> ]
as_polars_series(1:3)$mod(1L)
#> polars Series: shape: (3,)
#> Series: '' [i32]
#> [
#>  0
#>  0
#>  0
#> ]