Method: Polars::ArrayNameSpace#sort

Defined in:
lib/polars/array_name_space.rb

#sort(descending: false, nulls_last: false) ⇒ Series

Sort the arrays in this column.

Examples:

s = Polars::Series.new("a", [[3, 2, 1], [9, 1, 2]], dtype: Polars::Array.new(Polars::Int64, 3))
s.arr.sort
# =>
# shape: (2,)
# Series: 'a' [array[i64, 3]]
# [
#         [1, 2, 3]
#         [1, 2, 9]
# ]
s.arr.sort(descending: true)
# =>
# shape: (2,)
# Series: 'a' [array[i64, 3]]
# [
#         [3, 2, 1]
#         [9, 2, 1]
# ]

Parameters:

  • descending (Boolean) (defaults to: false)

    Sort in descending order.

  • nulls_last (Boolean) (defaults to: false)

    Place null values last.

Returns:


200
201
202
# File 'lib/polars/array_name_space.rb', line 200

def sort(descending: false, nulls_last: false)
  super
end