polars-df 0.5.0 → 0.6.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (42) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +14 -0
  3. data/Cargo.lock +337 -381
  4. data/README.md +4 -3
  5. data/ext/polars/Cargo.toml +5 -4
  6. data/ext/polars/src/apply/mod.rs +7 -3
  7. data/ext/polars/src/conversion.rs +171 -63
  8. data/ext/polars/src/dataframe.rs +19 -23
  9. data/ext/polars/src/error.rs +8 -0
  10. data/ext/polars/src/expr/array.rs +15 -0
  11. data/ext/polars/src/expr/general.rs +39 -9
  12. data/ext/polars/src/expr/list.rs +27 -22
  13. data/ext/polars/src/expr/string.rs +10 -9
  14. data/ext/polars/src/expr.rs +1 -0
  15. data/ext/polars/src/functions/lazy.rs +61 -21
  16. data/ext/polars/src/lazyframe.rs +14 -2
  17. data/ext/polars/src/lib.rs +25 -20
  18. data/ext/polars/src/object.rs +1 -1
  19. data/ext/polars/src/rb_modules.rs +4 -0
  20. data/ext/polars/src/series/construction.rs +28 -2
  21. data/ext/polars/src/series.rs +57 -17
  22. data/lib/polars/array_expr.rb +84 -0
  23. data/lib/polars/array_name_space.rb +77 -0
  24. data/lib/polars/batched_csv_reader.rb +1 -1
  25. data/lib/polars/data_frame.rb +91 -49
  26. data/lib/polars/data_types.rb +163 -29
  27. data/lib/polars/date_time_name_space.rb +17 -3
  28. data/lib/polars/expr.rb +76 -69
  29. data/lib/polars/functions.rb +0 -1
  30. data/lib/polars/group_by.rb +1 -22
  31. data/lib/polars/lazy_frame.rb +82 -30
  32. data/lib/polars/lazy_functions.rb +67 -31
  33. data/lib/polars/list_expr.rb +28 -28
  34. data/lib/polars/list_name_space.rb +13 -13
  35. data/lib/polars/rolling_group_by.rb +4 -2
  36. data/lib/polars/series.rb +70 -16
  37. data/lib/polars/string_expr.rb +137 -11
  38. data/lib/polars/string_name_space.rb +137 -22
  39. data/lib/polars/utils.rb +107 -57
  40. data/lib/polars/version.rb +1 -1
  41. data/lib/polars.rb +3 -0
  42. metadata +5 -2
@@ -14,7 +14,7 @@ module Polars
14
14
 
15
15
  if name.is_a?(DataType)
16
16
  Utils.wrap_expr(_dtype_cols([name]))
17
- elsif name.is_a?(Array)
17
+ elsif name.is_a?(::Array)
18
18
  if name.length == 0 || Utils.strlike?(name[0])
19
19
  name = name.map { |v| v.is_a?(Symbol) ? v.to_s : v }
20
20
  Utils.wrap_expr(RbExpr.cols(name))
@@ -36,7 +36,7 @@ module Polars
36
36
  # @example A horizontal rank computation by taking the elements of a list
37
37
  # df = Polars::DataFrame.new({"a" => [1, 8, 3], "b" => [4, 5, 2]})
38
38
  # df.with_column(
39
- # Polars.concat_list(["a", "b"]).arr.eval(Polars.element.rank).alias("rank")
39
+ # Polars.concat_list(["a", "b"]).list.eval(Polars.element.rank).alias("rank")
40
40
  # )
41
41
  # # =>
42
42
  # # shape: (3, 3)
@@ -156,9 +156,8 @@ module Polars
156
156
  column.sum
157
157
  elsif Utils.strlike?(column)
158
158
  col(column.to_s).sum
159
- elsif column.is_a?(Array)
159
+ elsif column.is_a?(::Array)
160
160
  exprs = Utils.selection_to_rbexpr_list(column)
161
- # TODO
162
161
  Utils.wrap_expr(_sum_exprs(exprs))
163
162
  else
164
163
  fold(lit(0).cast(:u32), ->(a, b) { a + b }, column).alias("sum")
@@ -283,18 +282,33 @@ module Polars
283
282
  # Return an expression representing a literal value.
284
283
  #
285
284
  # @return [Expr]
286
- def lit(value)
287
- if value.is_a?(Polars::Series)
285
+ def lit(value, dtype: nil, allow_object: nil)
286
+ if value.is_a?(::Time) || value.is_a?(::DateTime)
287
+ time_unit = dtype&.time_unit || "ns"
288
+ time_zone = dtype.&time_zone
289
+ e = lit(Utils._datetime_to_pl_timestamp(value, time_unit)).cast(Datetime.new(time_unit))
290
+ if time_zone
291
+ return e.dt.replace_time_zone(time_zone.to_s)
292
+ else
293
+ return e
294
+ end
295
+ elsif value.is_a?(::Date)
296
+ return lit(::Time.utc(value.year, value.month, value.day)).cast(Date)
297
+ elsif value.is_a?(Polars::Series)
288
298
  name = value.name
289
299
  value = value._s
290
- e = Utils.wrap_expr(RbExpr.lit(value))
300
+ e = Utils.wrap_expr(RbExpr.lit(value, allow_object))
291
301
  if name == ""
292
302
  return e
293
303
  end
294
304
  return e.alias(name)
305
+ elsif (defined?(Numo::NArray) && value.is_a?(Numo::NArray)) || value.is_a?(::Array)
306
+ return lit(Series.new("", value))
307
+ elsif dtype
308
+ return Utils.wrap_expr(RbExpr.lit(value, allow_object)).cast(dtype)
295
309
  end
296
310
 
297
- Utils.wrap_expr(RbExpr.lit(value))
311
+ Utils.wrap_expr(RbExpr.lit(value, allow_object))
298
312
  end
299
313
 
300
314
  # Cumulatively sum values in a column/Series, or horizontally across list of columns/expressions.
@@ -625,23 +639,42 @@ module Polars
625
639
  # @return [Expr, Series]
626
640
  #
627
641
  # @example
628
- # df.lazy.filter(Polars.col("foo") < Polars.arange(0, 100)).collect
642
+ # Polars.arange(0, 3, eager: true)
643
+ # # =>
644
+ # # shape: (3,)
645
+ # # Series: 'arange' [i64]
646
+ # # [
647
+ # # 0
648
+ # # 1
649
+ # # 2
650
+ # # ]
651
+ #
652
+ # @example
653
+ # df = Polars::DataFrame.new({"a" => [1, 2], "b" => [3, 4]})
654
+ # df.select(Polars.arange(Polars.col("a"), Polars.col("b")))
655
+ # # =>
656
+ # # shape: (2, 1)
657
+ # # ┌───────────┐
658
+ # # │ arange │
659
+ # # │ --- │
660
+ # # │ list[i64] │
661
+ # # ╞═══════════╡
662
+ # # │ [1, 2] │
663
+ # # │ [2, 3] │
664
+ # # └───────────┘
629
665
  def arange(low, high, step: 1, eager: false, dtype: nil)
630
666
  low = Utils.expr_to_lit_or_expr(low, str_to_lit: false)
631
667
  high = Utils.expr_to_lit_or_expr(high, str_to_lit: false)
632
668
  range_expr = Utils.wrap_expr(RbExpr.arange(low._rbexpr, high._rbexpr, step))
633
669
 
634
- if !dtype.nil? && dtype != "i64"
670
+ if !dtype.nil? && !["i64", Int64].include?(dtype)
635
671
  range_expr = range_expr.cast(dtype)
636
672
  end
637
673
 
638
674
  if !eager
639
675
  range_expr
640
676
  else
641
- DataFrame.new
642
- .select(range_expr)
643
- .to_series
644
- .rename("arange", in_place: true)
677
+ DataFrame.new.select(range_expr.alias("arange")).to_series
645
678
  end
646
679
  end
647
680
 
@@ -658,7 +691,7 @@ module Polars
658
691
  #
659
692
  # @return [Expr]
660
693
  def arg_sort_by(exprs, reverse: false)
661
- if !exprs.is_a?(Array)
694
+ if !exprs.is_a?(::Array)
662
695
  exprs = [exprs]
663
696
  end
664
697
  if reverse == true || reverse == false
@@ -997,19 +1030,24 @@ module Polars
997
1030
  # Only used in `eager` mode. As expression, use `alias`.
998
1031
  #
999
1032
  # @return [Expr]
1000
- def repeat(value, n, eager: false, name: nil)
1033
+ def repeat(value, n, dtype: nil, eager: false, name: nil)
1034
+ if !name.nil?
1035
+ warn "the `name` argument is deprecated. Use the `alias` method instead."
1036
+ end
1037
+
1038
+ if n.is_a?(Integer)
1039
+ n = lit(n)
1040
+ end
1041
+
1042
+ value = Utils.parse_as_expression(value, str_as_lit: true)
1043
+ expr = Utils.wrap_expr(RbExpr.repeat(value, n._rbexpr, dtype))
1044
+ if !name.nil?
1045
+ expr = expr.alias(name)
1046
+ end
1001
1047
  if eager
1002
- if name.nil?
1003
- name = ""
1004
- end
1005
- dtype = py_type_to_dtype(type(value))
1006
- Series._repeat(name, value, n, dtype)
1007
- else
1008
- if n.is_a?(Integer)
1009
- n = lit(n)
1010
- end
1011
- Utils.wrap_expr(RbExpr.repeat(value, n._rbexpr))
1048
+ return select(expr).to_series
1012
1049
  end
1050
+ expr
1013
1051
  end
1014
1052
 
1015
1053
  # Return indices where `condition` evaluates `true`.
@@ -1124,13 +1162,11 @@ module Polars
1124
1162
  end
1125
1163
 
1126
1164
  if unit == "d"
1127
- expr = column.cast(:date)
1165
+ expr = column.cast(Date)
1128
1166
  elsif unit == "s"
1129
- raise Todo
1130
- # expr = (column.cast(:i64) * 1_000_000).cast(Datetime("us"))
1167
+ expr = (column.cast(Int64) * 1_000_000).cast(Datetime.new("us"))
1131
1168
  elsif Utils::DTYPE_TEMPORAL_UNITS.include?(unit)
1132
- raise Todo
1133
- # expr = column.cast(Datetime(unit))
1169
+ expr = column.cast(Datetime.new(unit))
1134
1170
  else
1135
1171
  raise ArgumentError, "'unit' must be one of {{'ns', 'us', 'ms', 's', 'd'}}, got '#{unit}'."
1136
1172
  end
@@ -15,7 +15,7 @@ module Polars
15
15
  #
16
16
  # @example
17
17
  # df = Polars::DataFrame.new({"foo" => [1, 2], "bar" => [["a", "b"], ["c"]]})
18
- # df.select(Polars.col("bar").arr.lengths)
18
+ # df.select(Polars.col("bar").list.lengths)
19
19
  # # =>
20
20
  # # shape: (2, 1)
21
21
  # # ┌─────┐
@@ -36,7 +36,7 @@ module Polars
36
36
  #
37
37
  # @example
38
38
  # df = Polars::DataFrame.new({"values" => [[1], [2, 3]]})
39
- # df.select(Polars.col("values").arr.sum)
39
+ # df.select(Polars.col("values").list.sum)
40
40
  # # =>
41
41
  # # shape: (2, 1)
42
42
  # # ┌────────┐
@@ -57,7 +57,7 @@ module Polars
57
57
  #
58
58
  # @example
59
59
  # df = Polars::DataFrame.new({"values" => [[1], [2, 3]]})
60
- # df.select(Polars.col("values").arr.max)
60
+ # df.select(Polars.col("values").list.max)
61
61
  # # =>
62
62
  # # shape: (2, 1)
63
63
  # # ┌────────┐
@@ -78,7 +78,7 @@ module Polars
78
78
  #
79
79
  # @example
80
80
  # df = Polars::DataFrame.new({"values" => [[1], [2, 3]]})
81
- # df.select(Polars.col("values").arr.min)
81
+ # df.select(Polars.col("values").list.min)
82
82
  # # =>
83
83
  # # shape: (2, 1)
84
84
  # # ┌────────┐
@@ -99,7 +99,7 @@ module Polars
99
99
  #
100
100
  # @example
101
101
  # df = Polars::DataFrame.new({"values" => [[1], [2, 3]]})
102
- # df.select(Polars.col("values").arr.mean)
102
+ # df.select(Polars.col("values").list.mean)
103
103
  # # =>
104
104
  # # shape: (2, 1)
105
105
  # # ┌────────┐
@@ -124,7 +124,7 @@ module Polars
124
124
  # "a" => [[3, 2, 1], [9, 1, 2]]
125
125
  # }
126
126
  # )
127
- # df.select(Polars.col("a").arr.sort)
127
+ # df.select(Polars.col("a").list.sort)
128
128
  # # =>
129
129
  # # shape: (2, 1)
130
130
  # # ┌───────────┐
@@ -149,7 +149,7 @@ module Polars
149
149
  # "a" => [[3, 2, 1], [9, 1, 2]]
150
150
  # }
151
151
  # )
152
- # df.select(Polars.col("a").arr.reverse)
152
+ # df.select(Polars.col("a").list.reverse)
153
153
  # # =>
154
154
  # # shape: (2, 1)
155
155
  # # ┌───────────┐
@@ -174,7 +174,7 @@ module Polars
174
174
  # "a" => [[1, 1, 2]]
175
175
  # }
176
176
  # )
177
- # df.select(Polars.col("a").arr.unique)
177
+ # df.select(Polars.col("a").list.unique)
178
178
  # # =>
179
179
  # # shape: (1, 1)
180
180
  # # ┌───────────┐
@@ -202,7 +202,7 @@ module Polars
202
202
  # "b" => [["b", "c"], ["y", "z"]]
203
203
  # }
204
204
  # )
205
- # df.select(Polars.col("a").arr.concat("b"))
205
+ # df.select(Polars.col("a").list.concat("b"))
206
206
  # # =>
207
207
  # # shape: (2, 1)
208
208
  # # ┌─────────────────┐
@@ -214,11 +214,11 @@ module Polars
214
214
  # # │ ["x", "y", "z"] │
215
215
  # # └─────────────────┘
216
216
  def concat(other)
217
- if other.is_a?(Array) && ![Expr, String, Series].any? { |c| other[0].is_a?(c) }
217
+ if other.is_a?(::Array) && ![Expr, String, Series].any? { |c| other[0].is_a?(c) }
218
218
  return concat(Series.new([other]))
219
219
  end
220
220
 
221
- if !other.is_a?(Array)
221
+ if !other.is_a?(::Array)
222
222
  other_list = [other]
223
223
  else
224
224
  other_list = other.dup
@@ -241,7 +241,7 @@ module Polars
241
241
  #
242
242
  # @example
243
243
  # df = Polars::DataFrame.new({"foo" => [[3, 2, 1], [], [1, 2]]})
244
- # df.select(Polars.col("foo").arr.get(0))
244
+ # df.select(Polars.col("foo").list.get(0))
245
245
  # # =>
246
246
  # # shape: (3, 1)
247
247
  # # ┌──────┐
@@ -254,7 +254,7 @@ module Polars
254
254
  # # │ 1 │
255
255
  # # └──────┘
256
256
  def get(index)
257
- index = Utils.expr_to_lit_or_expr(index, str_to_lit: false)._rbexpr
257
+ index = Utils.parse_as_expression(index)
258
258
  Utils.wrap_expr(_rbexpr.list_get(index))
259
259
  end
260
260
 
@@ -280,7 +280,7 @@ module Polars
280
280
  #
281
281
  # @return [Expr]
282
282
  def take(index, null_on_oob: false)
283
- if index.is_a?(Array)
283
+ if index.is_a?(::Array)
284
284
  index = Series.new(index)
285
285
  end
286
286
  index = Utils.expr_to_lit_or_expr(index, str_to_lit: false)._rbexpr
@@ -293,7 +293,7 @@ module Polars
293
293
  #
294
294
  # @example
295
295
  # df = Polars::DataFrame.new({"foo" => [[3, 2, 1], [], [1, 2]]})
296
- # df.select(Polars.col("foo").arr.first)
296
+ # df.select(Polars.col("foo").list.first)
297
297
  # # =>
298
298
  # # shape: (3, 1)
299
299
  # # ┌──────┐
@@ -315,7 +315,7 @@ module Polars
315
315
  #
316
316
  # @example
317
317
  # df = Polars::DataFrame.new({"foo" => [[3, 2, 1], [], [1, 2]]})
318
- # df.select(Polars.col("foo").arr.last)
318
+ # df.select(Polars.col("foo").list.last)
319
319
  # # =>
320
320
  # # shape: (3, 1)
321
321
  # # ┌──────┐
@@ -340,7 +340,7 @@ module Polars
340
340
  #
341
341
  # @example
342
342
  # df = Polars::DataFrame.new({"foo" => [[3, 2, 1], [], [1, 2]]})
343
- # df.select(Polars.col("foo").arr.contains(1))
343
+ # df.select(Polars.col("foo").list.contains(1))
344
344
  # # =>
345
345
  # # shape: (3, 1)
346
346
  # # ┌───────┐
@@ -367,7 +367,7 @@ module Polars
367
367
  #
368
368
  # @example
369
369
  # df = Polars::DataFrame.new({"s" => [["a", "b", "c"], ["x", "y"]]})
370
- # df.select(Polars.col("s").arr.join(" "))
370
+ # df.select(Polars.col("s").list.join(" "))
371
371
  # # =>
372
372
  # # shape: (2, 1)
373
373
  # # ┌───────┐
@@ -392,7 +392,7 @@ module Polars
392
392
  # "a" => [[1, 2], [2, 1]]
393
393
  # }
394
394
  # )
395
- # df.select(Polars.col("a").arr.arg_min)
395
+ # df.select(Polars.col("a").list.arg_min)
396
396
  # # =>
397
397
  # # shape: (2, 1)
398
398
  # # ┌─────┐
@@ -417,7 +417,7 @@ module Polars
417
417
  # "a" => [[1, 2], [2, 1]]
418
418
  # }
419
419
  # )
420
- # df.select(Polars.col("a").arr.arg_max)
420
+ # df.select(Polars.col("a").list.arg_max)
421
421
  # # =>
422
422
  # # shape: (2, 1)
423
423
  # # ┌─────┐
@@ -443,7 +443,7 @@ module Polars
443
443
  #
444
444
  # @example
445
445
  # s = Polars::Series.new("a", [[1, 2, 3, 4], [10, 2, 1]])
446
- # s.arr.diff
446
+ # s.list.diff
447
447
  # # =>
448
448
  # # shape: (2,)
449
449
  # # Series: 'a' [list[i64]]
@@ -464,7 +464,7 @@ module Polars
464
464
  #
465
465
  # @example
466
466
  # s = Polars::Series.new("a", [[1, 2, 3, 4], [10, 2, 1]])
467
- # s.arr.shift
467
+ # s.list.shift
468
468
  # # =>
469
469
  # # shape: (2,)
470
470
  # # Series: 'a' [list[i64]]
@@ -488,7 +488,7 @@ module Polars
488
488
  #
489
489
  # @example
490
490
  # s = Polars::Series.new("a", [[1, 2, 3, 4], [10, 2, 1]])
491
- # s.arr.slice(1, 2)
491
+ # s.list.slice(1, 2)
492
492
  # # =>
493
493
  # # shape: (2,)
494
494
  # # Series: 'a' [list[i64]]
@@ -511,7 +511,7 @@ module Polars
511
511
  #
512
512
  # @example
513
513
  # s = Polars::Series.new("a", [[1, 2, 3, 4], [10, 2, 1]])
514
- # s.arr.head(2)
514
+ # s.list.head(2)
515
515
  # # =>
516
516
  # # shape: (2,)
517
517
  # # Series: 'a' [list[i64]]
@@ -532,7 +532,7 @@ module Polars
532
532
  #
533
533
  # @example
534
534
  # s = Polars::Series.new("a", [[1, 2, 3, 4], [10, 2, 1]])
535
- # s.arr.tail(2)
535
+ # s.list.tail(2)
536
536
  # # =>
537
537
  # # shape: (2,)
538
538
  # # Series: 'a' [list[i64]]
@@ -554,7 +554,7 @@ module Polars
554
554
  #
555
555
  # @example
556
556
  # df = Polars::DataFrame.new({"listcol" => [[0], [1], [1, 2, 3, 2], [1, 2, 1], [4, 4]]})
557
- # df.select(Polars.col("listcol").arr.count_match(2).alias("number_of_twos"))
557
+ # df.select(Polars.col("listcol").list.count_match(2).alias("number_of_twos"))
558
558
  # # =>
559
559
  # # shape: (5, 1)
560
560
  # # ┌────────────────┐
@@ -584,7 +584,7 @@ module Polars
584
584
  #
585
585
  # @example
586
586
  # df = Polars::DataFrame.new({"a" => [[1, 2, 3], [1, 2]]})
587
- # df.select([Polars.col("a").arr.to_struct])
587
+ # df.select([Polars.col("a").list.to_struct])
588
588
  # # =>
589
589
  # # shape: (2, 1)
590
590
  # # ┌────────────┐
@@ -617,7 +617,7 @@ module Polars
617
617
  # @example
618
618
  # df = Polars::DataFrame.new({"a" => [1, 8, 3], "b" => [4, 5, 2]})
619
619
  # df.with_column(
620
- # Polars.concat_list(["a", "b"]).arr.eval(Polars.element.rank).alias("rank")
620
+ # Polars.concat_list(["a", "b"]).list.eval(Polars.element.rank).alias("rank")
621
621
  # )
622
622
  # # =>
623
623
  # # shape: (3, 3)
@@ -1,9 +1,9 @@
1
1
  module Polars
2
- # Series.arr namespace.
2
+ # Series.list namespace.
3
3
  class ListNameSpace
4
4
  include ExprDispatch
5
5
 
6
- self._accessor = "arr"
6
+ self._accessor = "list"
7
7
 
8
8
  # @private
9
9
  def initialize(series)
@@ -16,7 +16,7 @@ module Polars
16
16
  #
17
17
  # @example
18
18
  # s = Polars::Series.new([[1, 2, 3], [5]])
19
- # s.arr.lengths
19
+ # s.list.lengths
20
20
  # # =>
21
21
  # # shape: (2,)
22
22
  # # Series: '' [u32]
@@ -119,13 +119,13 @@ module Polars
119
119
  #
120
120
  # @example
121
121
  # s = Polars::Series.new([["foo", "bar"], ["hello", "world"]])
122
- # s.arr.join("-")
122
+ # s.list.join("-")
123
123
  # # =>
124
124
  # # shape: (2,)
125
125
  # # Series: '' [str]
126
126
  # # [
127
- # # "foo-bar"
128
- # # "hello-world"
127
+ # # "foo-bar"
128
+ # # "hello-world"
129
129
  # # ]
130
130
  def join(separator)
131
131
  super
@@ -180,7 +180,7 @@ module Polars
180
180
  #
181
181
  # @example
182
182
  # s = Polars::Series.new("a", [[1, 2, 3, 4], [10, 2, 1]])
183
- # s.arr.diff
183
+ # s.list.diff
184
184
  # # =>
185
185
  # # shape: (2,)
186
186
  # # Series: 'a' [list[i64]]
@@ -201,7 +201,7 @@ module Polars
201
201
  #
202
202
  # @example
203
203
  # s = Polars::Series.new("a", [[1, 2, 3, 4], [10, 2, 1]])
204
- # s.arr.shift
204
+ # s.list.shift
205
205
  # # =>
206
206
  # # shape: (2,)
207
207
  # # Series: 'a' [list[i64]]
@@ -225,7 +225,7 @@ module Polars
225
225
  #
226
226
  # @example
227
227
  # s = Polars::Series.new("a", [[1, 2, 3, 4], [10, 2, 1]])
228
- # s.arr.slice(1, 2)
228
+ # s.list.slice(1, 2)
229
229
  # # =>
230
230
  # # shape: (2,)
231
231
  # # Series: 'a' [list[i64]]
@@ -246,7 +246,7 @@ module Polars
246
246
  #
247
247
  # @example
248
248
  # s = Polars::Series.new("a", [[1, 2, 3, 4], [10, 2, 1]])
249
- # s.arr.head(2)
249
+ # s.list.head(2)
250
250
  # # =>
251
251
  # # shape: (2,)
252
252
  # # Series: 'a' [list[i64]]
@@ -267,7 +267,7 @@ module Polars
267
267
  #
268
268
  # @example
269
269
  # s = Polars::Series.new("a", [[1, 2, 3, 4], [10, 2, 1]])
270
- # s.arr.tail(2)
270
+ # s.list.tail(2)
271
271
  # # =>
272
272
  # # shape: (2,)
273
273
  # # Series: 'a' [list[i64]]
@@ -291,7 +291,7 @@ module Polars
291
291
  #
292
292
  # @example
293
293
  # df = Polars::DataFrame.new({"a" => [[1, 2, 3], [1, 2]]})
294
- # df.select([Polars.col("a").arr.to_struct])
294
+ # df.select([Polars.col("a").list.to_struct])
295
295
  # # =>
296
296
  # # shape: (2, 1)
297
297
  # # ┌────────────┐
@@ -323,7 +323,7 @@ module Polars
323
323
  # @example
324
324
  # df = Polars::DataFrame.new({"a" => [1, 8, 3], "b" => [4, 5, 2]})
325
325
  # df.with_column(
326
- # Polars.concat_list(["a", "b"]).arr.eval(Polars.element.rank).alias("rank")
326
+ # Polars.concat_list(["a", "b"]).list.eval(Polars.element.rank).alias("rank")
327
327
  # )
328
328
  # # =>
329
329
  # # shape: (3, 3)
@@ -10,7 +10,8 @@ module Polars
10
10
  period,
11
11
  offset,
12
12
  closed,
13
- by
13
+ by,
14
+ check_sorted
14
15
  )
15
16
  period = Utils._timedelta_to_pl_duration(period)
16
17
  offset = Utils._timedelta_to_pl_duration(offset)
@@ -21,12 +22,13 @@ module Polars
21
22
  @offset = offset
22
23
  @closed = closed
23
24
  @by = by
25
+ @check_sorted = check_sorted
24
26
  end
25
27
 
26
28
  def agg(aggs)
27
29
  @df.lazy
28
30
  .groupby_rolling(
29
- index_column: @time_column, period: @period, offset: @offset, closed: @closed, by: @by
31
+ index_column: @time_column, period: @period, offset: @offset, closed: @closed, by: @by, check_sorted: @check_sorted
30
32
  )
31
33
  .agg(aggs)
32
34
  .collect(no_optimization: true, string_cache: false)