polars-df 0.10.0 → 0.12.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (92) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +27 -0
  3. data/Cargo.lock +392 -351
  4. data/README.md +6 -6
  5. data/ext/polars/Cargo.toml +12 -7
  6. data/ext/polars/src/batched_csv.rs +53 -52
  7. data/ext/polars/src/conversion/any_value.rs +261 -0
  8. data/ext/polars/src/conversion/chunked_array.rs +4 -4
  9. data/ext/polars/src/conversion/mod.rs +60 -66
  10. data/ext/polars/src/dataframe/construction.rs +184 -0
  11. data/ext/polars/src/dataframe/export.rs +48 -0
  12. data/ext/polars/src/dataframe/general.rs +597 -0
  13. data/ext/polars/src/dataframe/io.rs +473 -0
  14. data/ext/polars/src/dataframe/mod.rs +26 -0
  15. data/ext/polars/src/error.rs +26 -4
  16. data/ext/polars/src/expr/categorical.rs +0 -10
  17. data/ext/polars/src/expr/datetime.rs +4 -8
  18. data/ext/polars/src/expr/general.rs +129 -94
  19. data/ext/polars/src/expr/mod.rs +2 -2
  20. data/ext/polars/src/expr/rolling.rs +201 -77
  21. data/ext/polars/src/expr/string.rs +11 -36
  22. data/ext/polars/src/functions/eager.rs +10 -10
  23. data/ext/polars/src/functions/lazy.rs +23 -21
  24. data/ext/polars/src/functions/range.rs +69 -1
  25. data/ext/polars/src/interop/mod.rs +1 -0
  26. data/ext/polars/src/interop/numo/mod.rs +2 -0
  27. data/ext/polars/src/interop/numo/to_numo_df.rs +23 -0
  28. data/ext/polars/src/interop/numo/to_numo_series.rs +61 -0
  29. data/ext/polars/src/lazyframe/mod.rs +135 -136
  30. data/ext/polars/src/lib.rs +94 -59
  31. data/ext/polars/src/map/dataframe.rs +2 -2
  32. data/ext/polars/src/map/lazy.rs +5 -25
  33. data/ext/polars/src/map/series.rs +7 -1
  34. data/ext/polars/src/rb_modules.rs +25 -1
  35. data/ext/polars/src/series/aggregation.rs +49 -30
  36. data/ext/polars/src/series/arithmetic.rs +21 -11
  37. data/ext/polars/src/series/construction.rs +56 -38
  38. data/ext/polars/src/series/export.rs +131 -49
  39. data/ext/polars/src/series/mod.rs +32 -141
  40. data/ext/polars/src/sql.rs +3 -1
  41. data/lib/polars/array_expr.rb +4 -4
  42. data/lib/polars/batched_csv_reader.rb +11 -5
  43. data/lib/polars/cat_expr.rb +0 -36
  44. data/lib/polars/cat_name_space.rb +0 -37
  45. data/lib/polars/convert.rb +6 -1
  46. data/lib/polars/data_frame.rb +176 -403
  47. data/lib/polars/data_types.rb +1 -1
  48. data/lib/polars/date_time_expr.rb +525 -572
  49. data/lib/polars/date_time_name_space.rb +263 -460
  50. data/lib/polars/dynamic_group_by.rb +5 -5
  51. data/lib/polars/exceptions.rb +7 -0
  52. data/lib/polars/expr.rb +1394 -243
  53. data/lib/polars/expr_dispatch.rb +1 -1
  54. data/lib/polars/functions/aggregation/horizontal.rb +8 -8
  55. data/lib/polars/functions/as_datatype.rb +63 -40
  56. data/lib/polars/functions/lazy.rb +63 -14
  57. data/lib/polars/functions/lit.rb +1 -1
  58. data/lib/polars/functions/range/date_range.rb +90 -57
  59. data/lib/polars/functions/range/datetime_range.rb +149 -0
  60. data/lib/polars/functions/range/int_range.rb +2 -2
  61. data/lib/polars/functions/range/time_range.rb +141 -0
  62. data/lib/polars/functions/repeat.rb +1 -1
  63. data/lib/polars/functions/whenthen.rb +1 -1
  64. data/lib/polars/group_by.rb +88 -23
  65. data/lib/polars/io/avro.rb +24 -0
  66. data/lib/polars/{io.rb → io/csv.rb} +299 -493
  67. data/lib/polars/io/database.rb +73 -0
  68. data/lib/polars/io/ipc.rb +247 -0
  69. data/lib/polars/io/json.rb +29 -0
  70. data/lib/polars/io/ndjson.rb +80 -0
  71. data/lib/polars/io/parquet.rb +227 -0
  72. data/lib/polars/lazy_frame.rb +143 -272
  73. data/lib/polars/lazy_group_by.rb +100 -3
  74. data/lib/polars/list_expr.rb +11 -11
  75. data/lib/polars/list_name_space.rb +5 -1
  76. data/lib/polars/rolling_group_by.rb +7 -9
  77. data/lib/polars/series.rb +103 -187
  78. data/lib/polars/string_expr.rb +78 -102
  79. data/lib/polars/string_name_space.rb +5 -4
  80. data/lib/polars/testing.rb +2 -2
  81. data/lib/polars/utils/constants.rb +9 -0
  82. data/lib/polars/utils/convert.rb +97 -0
  83. data/lib/polars/utils/parse.rb +89 -0
  84. data/lib/polars/utils/various.rb +76 -0
  85. data/lib/polars/utils/wrap.rb +19 -0
  86. data/lib/polars/utils.rb +8 -300
  87. data/lib/polars/version.rb +1 -1
  88. data/lib/polars/whenthen.rb +6 -6
  89. data/lib/polars.rb +20 -1
  90. metadata +28 -7
  91. data/ext/polars/src/conversion/anyvalue.rs +0 -186
  92. data/ext/polars/src/dataframe.rs +0 -1208
@@ -46,7 +46,7 @@ impl RbExpr {
46
46
  }
47
47
 
48
48
  pub fn eq(&self, other: &Self) -> Self {
49
- self.clone().inner.eq(other.inner.clone()).into()
49
+ self.inner.clone().eq(other.inner.clone()).into()
50
50
  }
51
51
 
52
52
  pub fn eq_missing(&self, other: &Self) -> Self {
@@ -54,7 +54,7 @@ impl RbExpr {
54
54
  }
55
55
 
56
56
  pub fn neq(&self, other: &Self) -> Self {
57
- self.clone().inner.neq(other.inner.clone()).into()
57
+ self.inner.clone().neq(other.inner.clone()).into()
58
58
  }
59
59
 
60
60
  pub fn neq_missing(&self, other: &Self) -> Self {
@@ -62,112 +62,112 @@ impl RbExpr {
62
62
  }
63
63
 
64
64
  pub fn gt(&self, other: &Self) -> Self {
65
- self.clone().inner.gt(other.inner.clone()).into()
65
+ self.inner.clone().gt(other.inner.clone()).into()
66
66
  }
67
67
 
68
68
  pub fn gt_eq(&self, other: &Self) -> Self {
69
- self.clone().inner.gt_eq(other.inner.clone()).into()
69
+ self.inner.clone().gt_eq(other.inner.clone()).into()
70
70
  }
71
71
 
72
72
  pub fn lt_eq(&self, other: &Self) -> Self {
73
- self.clone().inner.lt_eq(other.inner.clone()).into()
73
+ self.inner.clone().lt_eq(other.inner.clone()).into()
74
74
  }
75
75
 
76
76
  pub fn lt(&self, other: &Self) -> Self {
77
- self.clone().inner.lt(other.inner.clone()).into()
77
+ self.inner.clone().lt(other.inner.clone()).into()
78
78
  }
79
79
 
80
80
  pub fn alias(&self, name: String) -> Self {
81
- self.clone().inner.alias(&name).into()
81
+ self.inner.clone().alias(&name).into()
82
82
  }
83
83
 
84
84
  pub fn not_(&self) -> Self {
85
- self.clone().inner.not().into()
85
+ self.inner.clone().not().into()
86
86
  }
87
87
 
88
88
  pub fn is_null(&self) -> Self {
89
- self.clone().inner.is_null().into()
89
+ self.inner.clone().is_null().into()
90
90
  }
91
91
 
92
92
  pub fn is_not_null(&self) -> Self {
93
- self.clone().inner.is_not_null().into()
93
+ self.inner.clone().is_not_null().into()
94
94
  }
95
95
 
96
96
  pub fn is_infinite(&self) -> Self {
97
- self.clone().inner.is_infinite().into()
97
+ self.inner.clone().is_infinite().into()
98
98
  }
99
99
 
100
100
  pub fn is_finite(&self) -> Self {
101
- self.clone().inner.is_finite().into()
101
+ self.inner.clone().is_finite().into()
102
102
  }
103
103
 
104
104
  pub fn is_nan(&self) -> Self {
105
- self.clone().inner.is_nan().into()
105
+ self.inner.clone().is_nan().into()
106
106
  }
107
107
 
108
108
  pub fn is_not_nan(&self) -> Self {
109
- self.clone().inner.is_not_nan().into()
109
+ self.inner.clone().is_not_nan().into()
110
110
  }
111
111
 
112
112
  pub fn min(&self) -> Self {
113
- self.clone().inner.min().into()
113
+ self.inner.clone().min().into()
114
114
  }
115
115
 
116
116
  pub fn max(&self) -> Self {
117
- self.clone().inner.max().into()
117
+ self.inner.clone().max().into()
118
118
  }
119
119
 
120
120
  pub fn nan_max(&self) -> Self {
121
- self.clone().inner.nan_max().into()
121
+ self.inner.clone().nan_max().into()
122
122
  }
123
123
 
124
124
  pub fn nan_min(&self) -> Self {
125
- self.clone().inner.nan_min().into()
125
+ self.inner.clone().nan_min().into()
126
126
  }
127
127
 
128
128
  pub fn mean(&self) -> Self {
129
- self.clone().inner.mean().into()
129
+ self.inner.clone().mean().into()
130
130
  }
131
131
 
132
132
  pub fn median(&self) -> Self {
133
- self.clone().inner.median().into()
133
+ self.inner.clone().median().into()
134
134
  }
135
135
 
136
136
  pub fn sum(&self) -> Self {
137
- self.clone().inner.sum().into()
137
+ self.inner.clone().sum().into()
138
138
  }
139
139
 
140
140
  pub fn n_unique(&self) -> Self {
141
- self.clone().inner.n_unique().into()
141
+ self.inner.clone().n_unique().into()
142
142
  }
143
143
 
144
144
  pub fn arg_unique(&self) -> Self {
145
- self.clone().inner.arg_unique().into()
145
+ self.inner.clone().arg_unique().into()
146
146
  }
147
147
 
148
148
  pub fn unique(&self) -> Self {
149
- self.clone().inner.unique().into()
149
+ self.inner.clone().unique().into()
150
150
  }
151
151
 
152
152
  pub fn unique_stable(&self) -> Self {
153
- self.clone().inner.unique_stable().into()
153
+ self.inner.clone().unique_stable().into()
154
154
  }
155
155
 
156
156
  pub fn first(&self) -> Self {
157
- self.clone().inner.first().into()
157
+ self.inner.clone().first().into()
158
158
  }
159
159
 
160
160
  pub fn last(&self) -> Self {
161
- self.clone().inner.last().into()
161
+ self.inner.clone().last().into()
162
162
  }
163
163
 
164
164
  pub fn implode(&self) -> Self {
165
- self.clone().inner.implode().into()
165
+ self.inner.clone().implode().into()
166
166
  }
167
167
 
168
168
  pub fn quantile(&self, quantile: &Self, interpolation: Wrap<QuantileInterpolOptions>) -> Self {
169
- self.clone()
170
- .inner
169
+ self.inner
170
+ .clone()
171
171
  .quantile(quantile.inner.clone(), interpolation.0)
172
172
  .into()
173
173
  }
@@ -239,10 +239,10 @@ impl RbExpr {
239
239
  self.inner.clone().len().into()
240
240
  }
241
241
 
242
- pub fn value_counts(&self, multithreaded: bool, sorted: bool) -> Self {
242
+ pub fn value_counts(&self, sort: bool, parallel: bool, name: String, normalize: bool) -> Self {
243
243
  self.inner
244
244
  .clone()
245
- .value_counts(multithreaded, sorted)
245
+ .value_counts(sort, parallel, name, normalize)
246
246
  .into()
247
247
  }
248
248
 
@@ -292,10 +292,28 @@ impl RbExpr {
292
292
  self.inner.clone().top_k(k.inner.clone()).into()
293
293
  }
294
294
 
295
+ pub fn top_k_by(&self, by: RArray, k: &Self, reverse: Vec<bool>) -> RbResult<Self> {
296
+ let by = rb_exprs_to_exprs(by)?;
297
+ Ok(self
298
+ .inner
299
+ .clone()
300
+ .top_k_by(k.inner.clone(), by, reverse)
301
+ .into())
302
+ }
303
+
295
304
  pub fn bottom_k(&self, k: &Self) -> Self {
296
305
  self.inner.clone().bottom_k(k.inner.clone()).into()
297
306
  }
298
307
 
308
+ pub fn bottom_k_by(&self, by: RArray, k: &Self, reverse: Vec<bool>) -> RbResult<Self> {
309
+ let by = rb_exprs_to_exprs(by)?;
310
+ Ok(self
311
+ .inner
312
+ .clone()
313
+ .bottom_k_by(k.inner.clone(), by, reverse)
314
+ .into())
315
+ }
316
+
299
317
  pub fn peak_min(&self) -> Self {
300
318
  self.inner.clone().peak_min().into()
301
319
  }
@@ -305,11 +323,11 @@ impl RbExpr {
305
323
  }
306
324
 
307
325
  pub fn arg_max(&self) -> Self {
308
- self.clone().inner.arg_max().into()
326
+ self.inner.clone().arg_max().into()
309
327
  }
310
328
 
311
329
  pub fn arg_min(&self) -> Self {
312
- self.clone().inner.arg_min().into()
330
+ self.inner.clone().arg_min().into()
313
331
  }
314
332
 
315
333
  pub fn search_sorted(&self, element: &Self, side: Wrap<SearchSortedSide>) -> Self {
@@ -320,21 +338,25 @@ impl RbExpr {
320
338
  }
321
339
 
322
340
  pub fn gather(&self, idx: &Self) -> Self {
323
- self.clone().inner.gather(idx.inner.clone()).into()
341
+ self.inner.clone().gather(idx.inner.clone()).into()
342
+ }
343
+
344
+ pub fn get(&self, idx: &Self) -> Self {
345
+ self.inner.clone().get(idx.inner.clone()).into()
324
346
  }
325
347
 
326
348
  pub fn sort_by(
327
349
  &self,
328
350
  by: RArray,
329
351
  descending: Vec<bool>,
330
- nulls_last: bool,
352
+ nulls_last: Vec<bool>,
331
353
  multithreaded: bool,
332
354
  maintain_order: bool,
333
355
  ) -> RbResult<Self> {
334
356
  let by = rb_exprs_to_exprs(by)?;
335
357
  Ok(self
336
- .clone()
337
358
  .inner
359
+ .clone()
338
360
  .sort_by(
339
361
  by,
340
362
  SortMultipleOptions {
@@ -348,11 +370,11 @@ impl RbExpr {
348
370
  }
349
371
 
350
372
  pub fn backward_fill(&self, limit: FillNullLimit) -> Self {
351
- self.clone().inner.backward_fill(limit).into()
373
+ self.inner.clone().backward_fill(limit).into()
352
374
  }
353
375
 
354
376
  pub fn forward_fill(&self, limit: FillNullLimit) -> Self {
355
- self.clone().inner.forward_fill(limit).into()
377
+ self.inner.clone().forward_fill(limit).into()
356
378
  }
357
379
 
358
380
  pub fn shift(&self, n: &Self, fill_value: Option<&Self>) -> Self {
@@ -365,7 +387,7 @@ impl RbExpr {
365
387
  }
366
388
 
367
389
  pub fn fill_null(&self, expr: &Self) -> Self {
368
- self.clone().inner.fill_null(expr.inner.clone()).into()
390
+ self.inner.clone().fill_null(expr.inner.clone()).into()
369
391
  }
370
392
 
371
393
  pub fn fill_null_with_strategy(
@@ -398,39 +420,46 @@ impl RbExpr {
398
420
  }
399
421
 
400
422
  pub fn filter(&self, predicate: &Self) -> Self {
401
- self.clone().inner.filter(predicate.inner.clone()).into()
423
+ self.inner.clone().filter(predicate.inner.clone()).into()
402
424
  }
403
425
 
404
426
  pub fn reverse(&self) -> Self {
405
- self.clone().inner.reverse().into()
427
+ self.inner.clone().reverse().into()
406
428
  }
407
429
 
408
430
  pub fn std(&self, ddof: u8) -> Self {
409
- self.clone().inner.std(ddof).into()
431
+ self.inner.clone().std(ddof).into()
410
432
  }
411
433
 
412
434
  pub fn var(&self, ddof: u8) -> Self {
413
- self.clone().inner.var(ddof).into()
435
+ self.inner.clone().var(ddof).into()
414
436
  }
415
437
 
416
438
  pub fn is_unique(&self) -> Self {
417
- self.clone().inner.is_unique().into()
439
+ self.inner.clone().is_unique().into()
440
+ }
441
+
442
+ pub fn is_between(&self, lower: &Self, upper: &Self, closed: Wrap<ClosedInterval>) -> Self {
443
+ self.inner
444
+ .clone()
445
+ .is_between(lower.inner.clone(), upper.inner.clone(), closed.0)
446
+ .into()
418
447
  }
419
448
 
420
449
  pub fn approx_n_unique(&self) -> Self {
421
- self.clone().inner.approx_n_unique().into()
450
+ self.inner.clone().approx_n_unique().into()
422
451
  }
423
452
 
424
453
  pub fn is_first_distinct(&self) -> Self {
425
- self.clone().inner.is_first_distinct().into()
454
+ self.inner.clone().is_first_distinct().into()
426
455
  }
427
456
 
428
457
  pub fn is_last_distinct(&self) -> Self {
429
- self.clone().inner.is_last_distinct().into()
458
+ self.inner.clone().is_last_distinct().into()
430
459
  }
431
460
 
432
461
  pub fn explode(&self) -> Self {
433
- self.clone().inner.explode().into()
462
+ self.inner.clone().explode().into()
434
463
  }
435
464
 
436
465
  pub fn gather_every(&self, n: usize, offset: usize) -> Self {
@@ -445,11 +474,11 @@ impl RbExpr {
445
474
  }
446
475
 
447
476
  pub fn tail(&self, n: Option<usize>) -> Self {
448
- self.clone().inner.tail(n).into()
477
+ self.inner.clone().tail(n).into()
449
478
  }
450
479
 
451
480
  pub fn head(&self, n: Option<usize>) -> Self {
452
- self.clone().inner.head(n).into()
481
+ self.inner.clone().head(n).into()
453
482
  }
454
483
 
455
484
  pub fn slice(&self, offset: &Self, length: &Self) -> Self {
@@ -474,15 +503,15 @@ impl RbExpr {
474
503
  }
475
504
 
476
505
  pub fn round(&self, decimals: u32) -> Self {
477
- self.clone().inner.round(decimals).into()
506
+ self.inner.clone().round(decimals).into()
478
507
  }
479
508
 
480
509
  pub fn floor(&self) -> Self {
481
- self.clone().inner.floor().into()
510
+ self.inner.clone().floor().into()
482
511
  }
483
512
 
484
513
  pub fn ceil(&self) -> Self {
485
- self.clone().inner.ceil().into()
514
+ self.inner.clone().ceil().into()
486
515
  }
487
516
 
488
517
  pub fn clip(&self, min: Option<&Self>, max: Option<&Self>) -> Self {
@@ -497,120 +526,126 @@ impl RbExpr {
497
526
  }
498
527
 
499
528
  pub fn abs(&self) -> Self {
500
- self.clone().inner.abs().into()
529
+ self.inner.clone().abs().into()
501
530
  }
502
531
 
503
532
  pub fn sin(&self) -> Self {
504
- self.clone().inner.sin().into()
533
+ self.inner.clone().sin().into()
505
534
  }
506
535
 
507
536
  pub fn cos(&self) -> Self {
508
- self.clone().inner.cos().into()
537
+ self.inner.clone().cos().into()
509
538
  }
510
539
 
511
540
  pub fn tan(&self) -> Self {
512
- self.clone().inner.tan().into()
541
+ self.inner.clone().tan().into()
513
542
  }
514
543
 
515
544
  pub fn arcsin(&self) -> Self {
516
- self.clone().inner.arcsin().into()
545
+ self.inner.clone().arcsin().into()
517
546
  }
518
547
 
519
548
  pub fn arccos(&self) -> Self {
520
- self.clone().inner.arccos().into()
549
+ self.inner.clone().arccos().into()
521
550
  }
522
551
 
523
552
  pub fn arctan(&self) -> Self {
524
- self.clone().inner.arctan().into()
553
+ self.inner.clone().arctan().into()
525
554
  }
526
555
 
527
556
  pub fn sinh(&self) -> Self {
528
- self.clone().inner.sinh().into()
557
+ self.inner.clone().sinh().into()
529
558
  }
530
559
 
531
560
  pub fn cosh(&self) -> Self {
532
- self.clone().inner.cosh().into()
561
+ self.inner.clone().cosh().into()
533
562
  }
534
563
 
535
564
  pub fn tanh(&self) -> Self {
536
- self.clone().inner.tanh().into()
565
+ self.inner.clone().tanh().into()
537
566
  }
538
567
 
539
568
  pub fn arcsinh(&self) -> Self {
540
- self.clone().inner.arcsinh().into()
569
+ self.inner.clone().arcsinh().into()
541
570
  }
542
571
 
543
572
  pub fn arccosh(&self) -> Self {
544
- self.clone().inner.arccosh().into()
573
+ self.inner.clone().arccosh().into()
545
574
  }
546
575
 
547
576
  pub fn arctanh(&self) -> Self {
548
- self.clone().inner.arctanh().into()
577
+ self.inner.clone().arctanh().into()
549
578
  }
550
579
 
551
580
  pub fn sign(&self) -> Self {
552
- self.clone().inner.sign().into()
581
+ self.inner.clone().sign().into()
553
582
  }
554
583
 
555
584
  pub fn is_duplicated(&self) -> Self {
556
- self.clone().inner.is_duplicated().into()
585
+ self.inner.clone().is_duplicated().into()
557
586
  }
558
587
 
559
588
  pub fn over(&self, partition_by: RArray) -> RbResult<Self> {
560
589
  let partition_by = rb_exprs_to_exprs(partition_by)?;
561
- Ok(self.clone().inner.over(partition_by).into())
590
+ Ok(self.inner.clone().over(partition_by).into())
562
591
  }
563
592
 
564
593
  pub fn _and(&self, expr: &Self) -> Self {
565
- self.clone().inner.and(expr.inner.clone()).into()
594
+ self.inner.clone().and(expr.inner.clone()).into()
566
595
  }
567
596
 
568
597
  pub fn _xor(&self, expr: &Self) -> Self {
569
- self.clone().inner.xor(expr.inner.clone()).into()
598
+ self.inner.clone().xor(expr.inner.clone()).into()
570
599
  }
571
600
 
572
601
  pub fn _or(&self, expr: &Self) -> Self {
573
- self.clone().inner.or(expr.inner.clone()).into()
602
+ self.inner.clone().or(expr.inner.clone()).into()
574
603
  }
575
604
 
576
605
  pub fn is_in(&self, expr: &Self) -> Self {
577
- self.clone().inner.is_in(expr.inner.clone()).into()
606
+ self.inner.clone().is_in(expr.inner.clone()).into()
578
607
  }
579
608
 
580
609
  pub fn repeat_by(&self, by: &Self) -> Self {
581
- self.clone().inner.repeat_by(by.inner.clone()).into()
610
+ self.inner.clone().repeat_by(by.inner.clone()).into()
582
611
  }
583
612
 
584
613
  pub fn pow(&self, exponent: &Self) -> Self {
585
- self.clone().inner.pow(exponent.inner.clone()).into()
614
+ self.inner.clone().pow(exponent.inner.clone()).into()
586
615
  }
587
616
 
588
617
  pub fn cum_sum(&self, reverse: bool) -> Self {
589
- self.clone().inner.cum_sum(reverse).into()
618
+ self.inner.clone().cum_sum(reverse).into()
590
619
  }
591
620
 
592
621
  pub fn cum_max(&self, reverse: bool) -> Self {
593
- self.clone().inner.cum_max(reverse).into()
622
+ self.inner.clone().cum_max(reverse).into()
594
623
  }
595
624
 
596
625
  pub fn cum_min(&self, reverse: bool) -> Self {
597
- self.clone().inner.cum_min(reverse).into()
626
+ self.inner.clone().cum_min(reverse).into()
598
627
  }
599
628
 
600
629
  pub fn cum_prod(&self, reverse: bool) -> Self {
601
- self.clone().inner.cum_prod(reverse).into()
630
+ self.inner.clone().cum_prod(reverse).into()
602
631
  }
603
632
 
604
633
  pub fn product(&self) -> Self {
605
- self.clone().inner.product().into()
634
+ self.inner.clone().product().into()
606
635
  }
607
636
 
608
637
  pub fn shrink_dtype(&self) -> Self {
609
638
  self.inner.clone().shrink_dtype().into()
610
639
  }
611
640
 
612
- pub fn map(&self, lambda: Value, output_type: Option<Wrap<DataType>>, agg_list: bool) -> Self {
613
- map_single(self, lambda, output_type, agg_list)
641
+ pub fn map_batches(
642
+ &self,
643
+ lambda: Value,
644
+ output_type: Option<Wrap<DataType>>,
645
+ agg_list: bool,
646
+ is_elementwise: bool,
647
+ ) -> Self {
648
+ map_single(self, lambda, output_type, agg_list, is_elementwise)
614
649
  }
615
650
 
616
651
  pub fn dot(&self, other: &Self) -> Self {
@@ -682,7 +717,7 @@ impl RbExpr {
682
717
  }
683
718
 
684
719
  pub fn reshape(&self, dims: Vec<i64>) -> Self {
685
- self.inner.clone().reshape(&dims).into()
720
+ self.inner.clone().reshape(&dims, NestedType::Array).into()
686
721
  }
687
722
 
688
723
  pub fn cum_count(&self, reverse: bool) -> Self {
@@ -690,14 +725,7 @@ impl RbExpr {
690
725
  }
691
726
 
692
727
  pub fn to_physical(&self) -> Self {
693
- self.inner
694
- .clone()
695
- .map(
696
- |s| Ok(Some(s.to_physical_repr().into_owned())),
697
- GetOutput::map_dtype(|dt| dt.to_physical()),
698
- )
699
- .with_fmt("to_physical")
700
- .into()
728
+ self.inner.clone().to_physical().into()
701
729
  }
702
730
 
703
731
  pub fn shuffle(&self, seed: Option<u64>) -> Self {
@@ -833,7 +861,14 @@ impl RbExpr {
833
861
  self.inner.clone().set_sorted_flag(is_sorted).into()
834
862
  }
835
863
 
836
- pub fn replace(
864
+ pub fn replace(&self, old: &Self, new: &Self) -> Self {
865
+ self.inner
866
+ .clone()
867
+ .replace(old.inner.clone(), new.inner.clone())
868
+ .into()
869
+ }
870
+
871
+ pub fn replace_strict(
837
872
  &self,
838
873
  old: &Self,
839
874
  new: &Self,
@@ -842,7 +877,7 @@ impl RbExpr {
842
877
  ) -> Self {
843
878
  self.inner
844
879
  .clone()
845
- .replace(
880
+ .replace_strict(
846
881
  old.inner.clone(),
847
882
  new.inner.clone(),
848
883
  default.map(|e| e.inner.clone()),
@@ -29,8 +29,8 @@ impl From<Expr> for RbExpr {
29
29
 
30
30
  pub fn rb_exprs_to_exprs(rb_exprs: RArray) -> RbResult<Vec<Expr>> {
31
31
  let mut exprs = Vec::new();
32
- for item in rb_exprs.each() {
33
- exprs.push(<&RbExpr>::try_convert(item?)?.inner.clone());
32
+ for item in rb_exprs.into_iter() {
33
+ exprs.push(<&RbExpr>::try_convert(item)?.inner.clone());
34
34
  }
35
35
  Ok(exprs)
36
36
  }