Class: Polars::ArrayNameSpace

Inherits:
Object
  • Object
show all
Defined in:
lib/polars/array_name_space.rb

Overview

Series.arr namespace.

Instance Method Summary collapse

Dynamic Method Handling

This class handles dynamic methods through the method_missing method in the class Polars::ExprDispatch

Instance Method Details

#maxSeries

Compute the max values of the sub-arrays.

Examples:

s = Polars::Series.new(
  "a", [[1, 2], [4, 3]], dtype: Polars::Array.new(2, Polars::Int64)
)
s.arr.max
# =>
# shape: (2,)
# Series: 'a' [i64]
# [
#         2
#         4
# ]

Returns:



49
50
51
# File 'lib/polars/array_name_space.rb', line 49

def max
  super
end

#minSeries

Compute the min values of the sub-arrays.

Examples:

s = Polars::Series.new(
  "a", [[1, 2], [4, 3]], dtype: Polars::Array.new(2, Polars::Int64)
)
s.arr.min
# =>
# shape: (2,)
# Series: 'a' [i64]
# [
#         1
#         3
# ]

Returns:



29
30
31
# File 'lib/polars/array_name_space.rb', line 29

def min
  super
end

#sumSeries

Compute the sum values of the sub-arrays.

Examples:

df = Polars::DataFrame.new(
  {"a" => [[1, 2], [4, 3]]},
  schema: {"a" => Polars::Array.new(2, Polars::Int64)}
)
df.select(Polars.col("a").arr.sum)
# =>
# shape: (2, 1)
# ┌─────┐
# │ a   │
# │ --- │
# │ i64 │
# ╞═════╡
# │ 3   │
# │ 7   │
# └─────┘

Returns:



73
74
75
# File 'lib/polars/array_name_space.rb', line 73

def sum
  super
end