Method: Polars::Expr#gather_every

Defined in:
lib/polars/expr.rb

#gather_every(n, offset = 0) ⇒ Expr Also known as: take_every

Take every nth value in the Series and return as a new Series.

Examples:

df = Polars::DataFrame.new({"foo" => [1, 2, 3, 4, 5, 6, 7, 8, 9]})
df.select(Polars.col("foo").gather_every(3))
# =>
# shape: (3, 1)
# ┌─────┐
# │ foo │
# │ --- │
# │ i64 │
# ╞═════╡
# │ 1   │
# │ 4   │
# │ 7   │
# └─────┘

Returns:

[View source]

3081
3082
3083
# File 'lib/polars/expr.rb', line 3081

def gather_every(n, offset = 0)
  _from_rbexpr(_rbexpr.gather_every(n, offset))
end