polars-df 0.13.0 → 0.15.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +30 -0
- data/Cargo.lock +1368 -319
- data/LICENSE.txt +1 -0
- data/README.md +1 -2
- data/ext/polars/Cargo.toml +15 -6
- data/ext/polars/src/batched_csv.rs +10 -13
- data/ext/polars/src/conversion/any_value.rs +37 -21
- data/ext/polars/src/conversion/chunked_array.rs +3 -3
- data/ext/polars/src/conversion/mod.rs +159 -46
- data/ext/polars/src/dataframe/construction.rs +4 -7
- data/ext/polars/src/dataframe/export.rs +9 -2
- data/ext/polars/src/dataframe/general.rs +22 -16
- data/ext/polars/src/dataframe/io.rs +78 -174
- data/ext/polars/src/dataframe/mod.rs +1 -0
- data/ext/polars/src/dataframe/serde.rs +15 -0
- data/ext/polars/src/error.rs +31 -48
- data/ext/polars/src/exceptions.rs +24 -0
- data/ext/polars/src/expr/binary.rs +4 -42
- data/ext/polars/src/expr/datetime.rs +16 -7
- data/ext/polars/src/expr/general.rs +14 -23
- data/ext/polars/src/expr/list.rs +18 -11
- data/ext/polars/src/expr/name.rs +3 -2
- data/ext/polars/src/expr/rolling.rs +6 -7
- data/ext/polars/src/expr/string.rs +17 -37
- data/ext/polars/src/file.rs +59 -22
- data/ext/polars/src/functions/business.rs +15 -0
- data/ext/polars/src/functions/io.rs +6 -6
- data/ext/polars/src/functions/lazy.rs +17 -8
- data/ext/polars/src/functions/mod.rs +1 -0
- data/ext/polars/src/functions/range.rs +4 -2
- data/ext/polars/src/interop/arrow/mod.rs +1 -0
- data/ext/polars/src/interop/arrow/to_ruby.rs +83 -0
- data/ext/polars/src/interop/mod.rs +1 -0
- data/ext/polars/src/lazyframe/general.rs +877 -0
- data/ext/polars/src/lazyframe/mod.rs +3 -825
- data/ext/polars/src/lazyframe/serde.rs +31 -0
- data/ext/polars/src/lib.rs +44 -13
- data/ext/polars/src/map/dataframe.rs +46 -14
- data/ext/polars/src/map/lazy.rs +65 -4
- data/ext/polars/src/map/mod.rs +17 -16
- data/ext/polars/src/map/series.rs +106 -64
- data/ext/polars/src/on_startup.rs +2 -2
- data/ext/polars/src/series/aggregation.rs +1 -5
- data/ext/polars/src/series/arithmetic.rs +10 -10
- data/ext/polars/src/series/construction.rs +52 -25
- data/ext/polars/src/series/export.rs +1 -1
- data/ext/polars/src/series/general.rs +643 -0
- data/ext/polars/src/series/import.rs +55 -0
- data/ext/polars/src/series/mod.rs +11 -638
- data/ext/polars/src/series/scatter.rs +2 -2
- data/ext/polars/src/utils.rs +0 -20
- data/lib/polars/batched_csv_reader.rb +0 -2
- data/lib/polars/binary_expr.rb +133 -9
- data/lib/polars/binary_name_space.rb +101 -6
- data/lib/polars/config.rb +4 -0
- data/lib/polars/data_frame.rb +285 -62
- data/lib/polars/data_type_group.rb +28 -0
- data/lib/polars/data_types.rb +2 -0
- data/lib/polars/date_time_expr.rb +244 -0
- data/lib/polars/date_time_name_space.rb +87 -0
- data/lib/polars/expr.rb +109 -8
- data/lib/polars/functions/as_datatype.rb +51 -2
- data/lib/polars/functions/col.rb +1 -1
- data/lib/polars/functions/eager.rb +1 -3
- data/lib/polars/functions/lazy.rb +88 -10
- data/lib/polars/functions/range/time_range.rb +21 -21
- data/lib/polars/io/csv.rb +14 -16
- data/lib/polars/io/database.rb +2 -2
- data/lib/polars/io/ipc.rb +14 -12
- data/lib/polars/io/ndjson.rb +10 -0
- data/lib/polars/io/parquet.rb +168 -111
- data/lib/polars/lazy_frame.rb +649 -15
- data/lib/polars/list_name_space.rb +169 -0
- data/lib/polars/selectors.rb +1144 -0
- data/lib/polars/series.rb +470 -40
- data/lib/polars/string_cache.rb +27 -1
- data/lib/polars/string_expr.rb +0 -1
- data/lib/polars/string_name_space.rb +73 -3
- data/lib/polars/struct_name_space.rb +31 -7
- data/lib/polars/utils/various.rb +5 -1
- data/lib/polars/utils.rb +45 -10
- data/lib/polars/version.rb +1 -1
- data/lib/polars.rb +2 -1
- metadata +14 -4
- data/lib/polars/functions.rb +0 -57
@@ -173,7 +173,7 @@ impl<'a> ApplyLambda<'a> for BooleanChunked {
|
|
173
173
|
null_count += 1
|
174
174
|
}
|
175
175
|
}
|
176
|
-
Ok(Self::full_null(self.name(), self.len())
|
176
|
+
Ok(Self::full_null(self.name().clone(), self.len())
|
177
177
|
.into_series()
|
178
178
|
.into())
|
179
179
|
}
|
@@ -190,13 +190,25 @@ impl<'a> ApplyLambda<'a> for BooleanChunked {
|
|
190
190
|
.into_no_null_iter()
|
191
191
|
.skip(init_null_count + skip)
|
192
192
|
.map(|val| call_lambda(lambda, val).ok());
|
193
|
-
iterator_to_struct(
|
193
|
+
iterator_to_struct(
|
194
|
+
it,
|
195
|
+
init_null_count,
|
196
|
+
first_value,
|
197
|
+
self.name().clone(),
|
198
|
+
self.len(),
|
199
|
+
)
|
194
200
|
} else {
|
195
201
|
let it = self
|
196
202
|
.into_iter()
|
197
203
|
.skip(init_null_count + skip)
|
198
204
|
.map(|opt_val| opt_val.and_then(|val| call_lambda(lambda, val).ok()));
|
199
|
-
iterator_to_struct(
|
205
|
+
iterator_to_struct(
|
206
|
+
it,
|
207
|
+
init_null_count,
|
208
|
+
first_value,
|
209
|
+
self.name().clone(),
|
210
|
+
self.len(),
|
211
|
+
)
|
200
212
|
}
|
201
213
|
}
|
202
214
|
|
@@ -212,7 +224,7 @@ impl<'a> ApplyLambda<'a> for BooleanChunked {
|
|
212
224
|
{
|
213
225
|
let skip = usize::from(first_value.is_some());
|
214
226
|
if init_null_count == self.len() {
|
215
|
-
Ok(ChunkedArray::full_null(self.name(), self.len()))
|
227
|
+
Ok(ChunkedArray::full_null(self.name().clone(), self.len()))
|
216
228
|
} else if !self.has_nulls() {
|
217
229
|
let it = self
|
218
230
|
.into_no_null_iter()
|
@@ -222,7 +234,7 @@ impl<'a> ApplyLambda<'a> for BooleanChunked {
|
|
222
234
|
it,
|
223
235
|
init_null_count,
|
224
236
|
first_value,
|
225
|
-
self.name(),
|
237
|
+
self.name().clone(),
|
226
238
|
self.len(),
|
227
239
|
))
|
228
240
|
} else {
|
@@ -234,7 +246,7 @@ impl<'a> ApplyLambda<'a> for BooleanChunked {
|
|
234
246
|
it,
|
235
247
|
init_null_count,
|
236
248
|
first_value,
|
237
|
-
self.name(),
|
249
|
+
self.name().clone(),
|
238
250
|
self.len(),
|
239
251
|
))
|
240
252
|
}
|
@@ -248,7 +260,7 @@ impl<'a> ApplyLambda<'a> for BooleanChunked {
|
|
248
260
|
) -> RbResult<BooleanChunked> {
|
249
261
|
let skip = usize::from(first_value.is_some());
|
250
262
|
if init_null_count == self.len() {
|
251
|
-
Ok(ChunkedArray::full_null(self.name(), self.len()))
|
263
|
+
Ok(ChunkedArray::full_null(self.name().clone(), self.len()))
|
252
264
|
} else if !self.has_nulls() {
|
253
265
|
let it = self
|
254
266
|
.into_no_null_iter()
|
@@ -258,7 +270,7 @@ impl<'a> ApplyLambda<'a> for BooleanChunked {
|
|
258
270
|
it,
|
259
271
|
init_null_count,
|
260
272
|
first_value,
|
261
|
-
self.name(),
|
273
|
+
self.name().clone(),
|
262
274
|
self.len(),
|
263
275
|
))
|
264
276
|
} else {
|
@@ -270,7 +282,7 @@ impl<'a> ApplyLambda<'a> for BooleanChunked {
|
|
270
282
|
it,
|
271
283
|
init_null_count,
|
272
284
|
first_value,
|
273
|
-
self.name(),
|
285
|
+
self.name().clone(),
|
274
286
|
self.len(),
|
275
287
|
))
|
276
288
|
}
|
@@ -284,7 +296,7 @@ impl<'a> ApplyLambda<'a> for BooleanChunked {
|
|
284
296
|
) -> RbResult<StringChunked> {
|
285
297
|
let skip = usize::from(first_value.is_some());
|
286
298
|
if init_null_count == self.len() {
|
287
|
-
Ok(ChunkedArray::full_null(self.name(), self.len()))
|
299
|
+
Ok(ChunkedArray::full_null(self.name().clone(), self.len()))
|
288
300
|
} else if !self.has_nulls() {
|
289
301
|
let it = self
|
290
302
|
.into_no_null_iter()
|
@@ -295,7 +307,7 @@ impl<'a> ApplyLambda<'a> for BooleanChunked {
|
|
295
307
|
it,
|
296
308
|
init_null_count,
|
297
309
|
first_value,
|
298
|
-
self.name(),
|
310
|
+
self.name().clone(),
|
299
311
|
self.len(),
|
300
312
|
))
|
301
313
|
} else {
|
@@ -307,7 +319,7 @@ impl<'a> ApplyLambda<'a> for BooleanChunked {
|
|
307
319
|
it,
|
308
320
|
init_null_count,
|
309
321
|
first_value,
|
310
|
-
self.name(),
|
322
|
+
self.name().clone(),
|
311
323
|
self.len(),
|
312
324
|
))
|
313
325
|
}
|
@@ -322,7 +334,7 @@ impl<'a> ApplyLambda<'a> for BooleanChunked {
|
|
322
334
|
) -> RbResult<ListChunked> {
|
323
335
|
let skip = 1;
|
324
336
|
if init_null_count == self.len() {
|
325
|
-
Ok(ChunkedArray::full_null(self.name(), self.len()))
|
337
|
+
Ok(ChunkedArray::full_null(self.name().clone(), self.len()))
|
326
338
|
} else if !self.has_nulls() {
|
327
339
|
let it = self
|
328
340
|
.into_no_null_iter()
|
@@ -334,7 +346,7 @@ impl<'a> ApplyLambda<'a> for BooleanChunked {
|
|
334
346
|
it,
|
335
347
|
init_null_count,
|
336
348
|
Some(first_value),
|
337
|
-
self.name(),
|
349
|
+
self.name().clone(),
|
338
350
|
self.len(),
|
339
351
|
)
|
340
352
|
} else {
|
@@ -347,7 +359,7 @@ impl<'a> ApplyLambda<'a> for BooleanChunked {
|
|
347
359
|
it,
|
348
360
|
init_null_count,
|
349
361
|
Some(first_value),
|
350
|
-
self.name(),
|
362
|
+
self.name().clone(),
|
351
363
|
self.len(),
|
352
364
|
)
|
353
365
|
}
|
@@ -383,7 +395,7 @@ impl<'a> ApplyLambda<'a> for BooleanChunked {
|
|
383
395
|
});
|
384
396
|
avs.extend(iter);
|
385
397
|
}
|
386
|
-
Ok(Series::new(self.name(), &avs))
|
398
|
+
Ok(Series::new(self.name().clone(), &avs))
|
387
399
|
}
|
388
400
|
|
389
401
|
fn apply_lambda_with_object_out_type(
|
@@ -394,7 +406,7 @@ impl<'a> ApplyLambda<'a> for BooleanChunked {
|
|
394
406
|
) -> RbResult<ObjectChunked<ObjectValue>> {
|
395
407
|
let skip = usize::from(first_value.is_some());
|
396
408
|
if init_null_count == self.len() {
|
397
|
-
Ok(ChunkedArray::full_null(self.name(), self.len()))
|
409
|
+
Ok(ChunkedArray::full_null(self.name().clone(), self.len()))
|
398
410
|
} else if !self.has_nulls() {
|
399
411
|
let it = self
|
400
412
|
.into_no_null_iter()
|
@@ -405,7 +417,7 @@ impl<'a> ApplyLambda<'a> for BooleanChunked {
|
|
405
417
|
it,
|
406
418
|
init_null_count,
|
407
419
|
first_value,
|
408
|
-
self.name(),
|
420
|
+
self.name().clone(),
|
409
421
|
self.len(),
|
410
422
|
))
|
411
423
|
} else {
|
@@ -417,7 +429,7 @@ impl<'a> ApplyLambda<'a> for BooleanChunked {
|
|
417
429
|
it,
|
418
430
|
init_null_count,
|
419
431
|
first_value,
|
420
|
-
self.name(),
|
432
|
+
self.name().clone(),
|
421
433
|
self.len(),
|
422
434
|
))
|
423
435
|
}
|
@@ -445,7 +457,7 @@ where
|
|
445
457
|
null_count += 1
|
446
458
|
}
|
447
459
|
}
|
448
|
-
Ok(Self::full_null(self.name(), self.len())
|
460
|
+
Ok(Self::full_null(self.name().clone(), self.len())
|
449
461
|
.into_series()
|
450
462
|
.into())
|
451
463
|
}
|
@@ -462,13 +474,25 @@ where
|
|
462
474
|
.into_no_null_iter()
|
463
475
|
.skip(init_null_count + skip)
|
464
476
|
.map(|val| call_lambda(lambda, val).ok());
|
465
|
-
iterator_to_struct(
|
477
|
+
iterator_to_struct(
|
478
|
+
it,
|
479
|
+
init_null_count,
|
480
|
+
first_value,
|
481
|
+
self.name().clone(),
|
482
|
+
self.len(),
|
483
|
+
)
|
466
484
|
} else {
|
467
485
|
let it = self
|
468
486
|
.into_iter()
|
469
487
|
.skip(init_null_count + skip)
|
470
488
|
.map(|opt_val| opt_val.and_then(|val| call_lambda(lambda, val).ok()));
|
471
|
-
iterator_to_struct(
|
489
|
+
iterator_to_struct(
|
490
|
+
it,
|
491
|
+
init_null_count,
|
492
|
+
first_value,
|
493
|
+
self.name().clone(),
|
494
|
+
self.len(),
|
495
|
+
)
|
472
496
|
}
|
473
497
|
}
|
474
498
|
|
@@ -484,7 +508,7 @@ where
|
|
484
508
|
{
|
485
509
|
let skip = usize::from(first_value.is_some());
|
486
510
|
if init_null_count == self.len() {
|
487
|
-
Ok(ChunkedArray::full_null(self.name(), self.len()))
|
511
|
+
Ok(ChunkedArray::full_null(self.name().clone(), self.len()))
|
488
512
|
} else if !self.has_nulls() {
|
489
513
|
let it = self
|
490
514
|
.into_no_null_iter()
|
@@ -494,7 +518,7 @@ where
|
|
494
518
|
it,
|
495
519
|
init_null_count,
|
496
520
|
first_value,
|
497
|
-
self.name(),
|
521
|
+
self.name().clone(),
|
498
522
|
self.len(),
|
499
523
|
))
|
500
524
|
} else {
|
@@ -506,7 +530,7 @@ where
|
|
506
530
|
it,
|
507
531
|
init_null_count,
|
508
532
|
first_value,
|
509
|
-
self.name(),
|
533
|
+
self.name().clone(),
|
510
534
|
self.len(),
|
511
535
|
))
|
512
536
|
}
|
@@ -520,7 +544,7 @@ where
|
|
520
544
|
) -> RbResult<BooleanChunked> {
|
521
545
|
let skip = usize::from(first_value.is_some());
|
522
546
|
if init_null_count == self.len() {
|
523
|
-
Ok(ChunkedArray::full_null(self.name(), self.len()))
|
547
|
+
Ok(ChunkedArray::full_null(self.name().clone(), self.len()))
|
524
548
|
} else if !self.has_nulls() {
|
525
549
|
let it = self
|
526
550
|
.into_no_null_iter()
|
@@ -530,7 +554,7 @@ where
|
|
530
554
|
it,
|
531
555
|
init_null_count,
|
532
556
|
first_value,
|
533
|
-
self.name(),
|
557
|
+
self.name().clone(),
|
534
558
|
self.len(),
|
535
559
|
))
|
536
560
|
} else {
|
@@ -542,7 +566,7 @@ where
|
|
542
566
|
it,
|
543
567
|
init_null_count,
|
544
568
|
first_value,
|
545
|
-
self.name(),
|
569
|
+
self.name().clone(),
|
546
570
|
self.len(),
|
547
571
|
))
|
548
572
|
}
|
@@ -556,7 +580,7 @@ where
|
|
556
580
|
) -> RbResult<StringChunked> {
|
557
581
|
let skip = usize::from(first_value.is_some());
|
558
582
|
if init_null_count == self.len() {
|
559
|
-
Ok(ChunkedArray::full_null(self.name(), self.len()))
|
583
|
+
Ok(ChunkedArray::full_null(self.name().clone(), self.len()))
|
560
584
|
} else if !self.has_nulls() {
|
561
585
|
let it = self
|
562
586
|
.into_no_null_iter()
|
@@ -567,7 +591,7 @@ where
|
|
567
591
|
it,
|
568
592
|
init_null_count,
|
569
593
|
first_value,
|
570
|
-
self.name(),
|
594
|
+
self.name().clone(),
|
571
595
|
self.len(),
|
572
596
|
))
|
573
597
|
} else {
|
@@ -579,7 +603,7 @@ where
|
|
579
603
|
it,
|
580
604
|
init_null_count,
|
581
605
|
first_value,
|
582
|
-
self.name(),
|
606
|
+
self.name().clone(),
|
583
607
|
self.len(),
|
584
608
|
))
|
585
609
|
}
|
@@ -594,7 +618,7 @@ where
|
|
594
618
|
) -> RbResult<ListChunked> {
|
595
619
|
let skip = 1;
|
596
620
|
if init_null_count == self.len() {
|
597
|
-
Ok(ChunkedArray::full_null(self.name(), self.len()))
|
621
|
+
Ok(ChunkedArray::full_null(self.name().clone(), self.len()))
|
598
622
|
} else if !self.has_nulls() {
|
599
623
|
let it = self
|
600
624
|
.into_no_null_iter()
|
@@ -606,7 +630,7 @@ where
|
|
606
630
|
it,
|
607
631
|
init_null_count,
|
608
632
|
Some(first_value),
|
609
|
-
self.name(),
|
633
|
+
self.name().clone(),
|
610
634
|
self.len(),
|
611
635
|
)
|
612
636
|
} else {
|
@@ -619,7 +643,7 @@ where
|
|
619
643
|
it,
|
620
644
|
init_null_count,
|
621
645
|
Some(first_value),
|
622
|
-
self.name(),
|
646
|
+
self.name().clone(),
|
623
647
|
self.len(),
|
624
648
|
)
|
625
649
|
}
|
@@ -655,7 +679,7 @@ where
|
|
655
679
|
});
|
656
680
|
avs.extend(iter);
|
657
681
|
}
|
658
|
-
Ok(Series::new(self.name(), &avs))
|
682
|
+
Ok(Series::new(self.name().clone(), &avs))
|
659
683
|
}
|
660
684
|
|
661
685
|
fn apply_lambda_with_object_out_type(
|
@@ -666,7 +690,7 @@ where
|
|
666
690
|
) -> RbResult<ObjectChunked<ObjectValue>> {
|
667
691
|
let skip = usize::from(first_value.is_some());
|
668
692
|
if init_null_count == self.len() {
|
669
|
-
Ok(ChunkedArray::full_null(self.name(), self.len()))
|
693
|
+
Ok(ChunkedArray::full_null(self.name().clone(), self.len()))
|
670
694
|
} else if !self.has_nulls() {
|
671
695
|
let it = self
|
672
696
|
.into_no_null_iter()
|
@@ -677,7 +701,7 @@ where
|
|
677
701
|
it,
|
678
702
|
init_null_count,
|
679
703
|
first_value,
|
680
|
-
self.name(),
|
704
|
+
self.name().clone(),
|
681
705
|
self.len(),
|
682
706
|
))
|
683
707
|
} else {
|
@@ -689,7 +713,7 @@ where
|
|
689
713
|
it,
|
690
714
|
init_null_count,
|
691
715
|
first_value,
|
692
|
-
self.name(),
|
716
|
+
self.name().clone(),
|
693
717
|
self.len(),
|
694
718
|
))
|
695
719
|
}
|
@@ -712,7 +736,7 @@ impl<'a> ApplyLambda<'a> for StringChunked {
|
|
712
736
|
null_count += 1
|
713
737
|
}
|
714
738
|
}
|
715
|
-
Ok(Self::full_null(self.name(), self.len())
|
739
|
+
Ok(Self::full_null(self.name().clone(), self.len())
|
716
740
|
.into_series()
|
717
741
|
.into())
|
718
742
|
}
|
@@ -729,13 +753,25 @@ impl<'a> ApplyLambda<'a> for StringChunked {
|
|
729
753
|
.into_no_null_iter()
|
730
754
|
.skip(init_null_count + skip)
|
731
755
|
.map(|val| call_lambda(lambda, val).ok());
|
732
|
-
iterator_to_struct(
|
756
|
+
iterator_to_struct(
|
757
|
+
it,
|
758
|
+
init_null_count,
|
759
|
+
first_value,
|
760
|
+
self.name().clone(),
|
761
|
+
self.len(),
|
762
|
+
)
|
733
763
|
} else {
|
734
764
|
let it = self
|
735
765
|
.into_iter()
|
736
766
|
.skip(init_null_count + skip)
|
737
767
|
.map(|opt_val| opt_val.and_then(|val| call_lambda(lambda, val).ok()));
|
738
|
-
iterator_to_struct(
|
768
|
+
iterator_to_struct(
|
769
|
+
it,
|
770
|
+
init_null_count,
|
771
|
+
first_value,
|
772
|
+
self.name().clone(),
|
773
|
+
self.len(),
|
774
|
+
)
|
739
775
|
}
|
740
776
|
}
|
741
777
|
|
@@ -751,7 +787,7 @@ impl<'a> ApplyLambda<'a> for StringChunked {
|
|
751
787
|
{
|
752
788
|
let skip = usize::from(first_value.is_some());
|
753
789
|
if init_null_count == self.len() {
|
754
|
-
Ok(ChunkedArray::full_null(self.name(), self.len()))
|
790
|
+
Ok(ChunkedArray::full_null(self.name().clone(), self.len()))
|
755
791
|
} else if !self.has_nulls() {
|
756
792
|
let it = self
|
757
793
|
.into_no_null_iter()
|
@@ -761,7 +797,7 @@ impl<'a> ApplyLambda<'a> for StringChunked {
|
|
761
797
|
it,
|
762
798
|
init_null_count,
|
763
799
|
first_value,
|
764
|
-
self.name(),
|
800
|
+
self.name().clone(),
|
765
801
|
self.len(),
|
766
802
|
))
|
767
803
|
} else {
|
@@ -773,7 +809,7 @@ impl<'a> ApplyLambda<'a> for StringChunked {
|
|
773
809
|
it,
|
774
810
|
init_null_count,
|
775
811
|
first_value,
|
776
|
-
self.name(),
|
812
|
+
self.name().clone(),
|
777
813
|
self.len(),
|
778
814
|
))
|
779
815
|
}
|
@@ -787,7 +823,7 @@ impl<'a> ApplyLambda<'a> for StringChunked {
|
|
787
823
|
) -> RbResult<BooleanChunked> {
|
788
824
|
let skip = usize::from(first_value.is_some());
|
789
825
|
if init_null_count == self.len() {
|
790
|
-
Ok(ChunkedArray::full_null(self.name(), self.len()))
|
826
|
+
Ok(ChunkedArray::full_null(self.name().clone(), self.len()))
|
791
827
|
} else if !self.has_nulls() {
|
792
828
|
let it = self
|
793
829
|
.into_no_null_iter()
|
@@ -797,7 +833,7 @@ impl<'a> ApplyLambda<'a> for StringChunked {
|
|
797
833
|
it,
|
798
834
|
init_null_count,
|
799
835
|
first_value,
|
800
|
-
self.name(),
|
836
|
+
self.name().clone(),
|
801
837
|
self.len(),
|
802
838
|
))
|
803
839
|
} else {
|
@@ -809,7 +845,7 @@ impl<'a> ApplyLambda<'a> for StringChunked {
|
|
809
845
|
it,
|
810
846
|
init_null_count,
|
811
847
|
first_value,
|
812
|
-
self.name(),
|
848
|
+
self.name().clone(),
|
813
849
|
self.len(),
|
814
850
|
))
|
815
851
|
}
|
@@ -823,7 +859,7 @@ impl<'a> ApplyLambda<'a> for StringChunked {
|
|
823
859
|
) -> RbResult<StringChunked> {
|
824
860
|
let skip = usize::from(first_value.is_some());
|
825
861
|
if init_null_count == self.len() {
|
826
|
-
Ok(ChunkedArray::full_null(self.name(), self.len()))
|
862
|
+
Ok(ChunkedArray::full_null(self.name().clone(), self.len()))
|
827
863
|
} else if !self.has_nulls() {
|
828
864
|
let it = self
|
829
865
|
.into_no_null_iter()
|
@@ -834,7 +870,7 @@ impl<'a> ApplyLambda<'a> for StringChunked {
|
|
834
870
|
it,
|
835
871
|
init_null_count,
|
836
872
|
first_value,
|
837
|
-
self.name(),
|
873
|
+
self.name().clone(),
|
838
874
|
self.len(),
|
839
875
|
))
|
840
876
|
} else {
|
@@ -846,7 +882,7 @@ impl<'a> ApplyLambda<'a> for StringChunked {
|
|
846
882
|
it,
|
847
883
|
init_null_count,
|
848
884
|
first_value,
|
849
|
-
self.name(),
|
885
|
+
self.name().clone(),
|
850
886
|
self.len(),
|
851
887
|
))
|
852
888
|
}
|
@@ -861,7 +897,7 @@ impl<'a> ApplyLambda<'a> for StringChunked {
|
|
861
897
|
) -> RbResult<ListChunked> {
|
862
898
|
let skip = 1;
|
863
899
|
if init_null_count == self.len() {
|
864
|
-
Ok(ChunkedArray::full_null(self.name(), self.len()))
|
900
|
+
Ok(ChunkedArray::full_null(self.name().clone(), self.len()))
|
865
901
|
} else if !self.has_nulls() {
|
866
902
|
let it = self
|
867
903
|
.into_no_null_iter()
|
@@ -873,7 +909,7 @@ impl<'a> ApplyLambda<'a> for StringChunked {
|
|
873
909
|
it,
|
874
910
|
init_null_count,
|
875
911
|
Some(first_value),
|
876
|
-
self.name(),
|
912
|
+
self.name().clone(),
|
877
913
|
self.len(),
|
878
914
|
)
|
879
915
|
} else {
|
@@ -886,7 +922,7 @@ impl<'a> ApplyLambda<'a> for StringChunked {
|
|
886
922
|
it,
|
887
923
|
init_null_count,
|
888
924
|
Some(first_value),
|
889
|
-
self.name(),
|
925
|
+
self.name().clone(),
|
890
926
|
self.len(),
|
891
927
|
)
|
892
928
|
}
|
@@ -922,7 +958,7 @@ impl<'a> ApplyLambda<'a> for StringChunked {
|
|
922
958
|
});
|
923
959
|
avs.extend(iter);
|
924
960
|
}
|
925
|
-
Ok(Series::new(self.name(), &avs))
|
961
|
+
Ok(Series::new(self.name().clone(), &avs))
|
926
962
|
}
|
927
963
|
|
928
964
|
fn apply_lambda_with_object_out_type(
|
@@ -933,7 +969,7 @@ impl<'a> ApplyLambda<'a> for StringChunked {
|
|
933
969
|
) -> RbResult<ObjectChunked<ObjectValue>> {
|
934
970
|
let skip = usize::from(first_value.is_some());
|
935
971
|
if init_null_count == self.len() {
|
936
|
-
Ok(ChunkedArray::full_null(self.name(), self.len()))
|
972
|
+
Ok(ChunkedArray::full_null(self.name().clone(), self.len()))
|
937
973
|
} else if !self.has_nulls() {
|
938
974
|
let it = self
|
939
975
|
.into_no_null_iter()
|
@@ -944,7 +980,7 @@ impl<'a> ApplyLambda<'a> for StringChunked {
|
|
944
980
|
it,
|
945
981
|
init_null_count,
|
946
982
|
first_value,
|
947
|
-
self.name(),
|
983
|
+
self.name().clone(),
|
948
984
|
self.len(),
|
949
985
|
))
|
950
986
|
} else {
|
@@ -956,7 +992,7 @@ impl<'a> ApplyLambda<'a> for StringChunked {
|
|
956
992
|
it,
|
957
993
|
init_null_count,
|
958
994
|
first_value,
|
959
|
-
self.name(),
|
995
|
+
self.name().clone(),
|
960
996
|
self.len(),
|
961
997
|
))
|
962
998
|
}
|
@@ -995,7 +1031,13 @@ impl<'a> ApplyLambda<'a> for StructChunked {
|
|
995
1031
|
let out = lambda.funcall("call", (Wrap(val),)).unwrap();
|
996
1032
|
Some(out)
|
997
1033
|
});
|
998
|
-
iterator_to_struct(
|
1034
|
+
iterator_to_struct(
|
1035
|
+
it,
|
1036
|
+
init_null_count,
|
1037
|
+
first_value,
|
1038
|
+
self.name().clone(),
|
1039
|
+
self.len(),
|
1040
|
+
)
|
999
1041
|
}
|
1000
1042
|
|
1001
1043
|
fn apply_lambda_with_primitive_out_type<D>(
|
@@ -1017,7 +1059,7 @@ impl<'a> ApplyLambda<'a> for StructChunked {
|
|
1017
1059
|
it,
|
1018
1060
|
init_null_count,
|
1019
1061
|
first_value,
|
1020
|
-
self.name(),
|
1062
|
+
self.name().clone(),
|
1021
1063
|
self.len(),
|
1022
1064
|
))
|
1023
1065
|
}
|
@@ -1037,7 +1079,7 @@ impl<'a> ApplyLambda<'a> for StructChunked {
|
|
1037
1079
|
it,
|
1038
1080
|
init_null_count,
|
1039
1081
|
first_value,
|
1040
|
-
self.name(),
|
1082
|
+
self.name().clone(),
|
1041
1083
|
self.len(),
|
1042
1084
|
))
|
1043
1085
|
}
|
@@ -1057,7 +1099,7 @@ impl<'a> ApplyLambda<'a> for StructChunked {
|
|
1057
1099
|
it,
|
1058
1100
|
init_null_count,
|
1059
1101
|
first_value,
|
1060
|
-
self.name(),
|
1102
|
+
self.name().clone(),
|
1061
1103
|
self.len(),
|
1062
1104
|
))
|
1063
1105
|
}
|
@@ -1078,7 +1120,7 @@ impl<'a> ApplyLambda<'a> for StructChunked {
|
|
1078
1120
|
it,
|
1079
1121
|
init_null_count,
|
1080
1122
|
Some(first_value),
|
1081
|
-
self.name(),
|
1123
|
+
self.name().clone(),
|
1082
1124
|
self.len(),
|
1083
1125
|
)
|
1084
1126
|
}
|
@@ -1100,7 +1142,7 @@ impl<'a> ApplyLambda<'a> for StructChunked {
|
|
1100
1142
|
});
|
1101
1143
|
avs.extend(iter);
|
1102
1144
|
|
1103
|
-
Ok(Series::new(self.name(), &avs))
|
1145
|
+
Ok(Series::new(self.name().clone(), &avs))
|
1104
1146
|
}
|
1105
1147
|
|
1106
1148
|
fn apply_lambda_with_object_out_type(
|
@@ -1118,7 +1160,7 @@ impl<'a> ApplyLambda<'a> for StructChunked {
|
|
1118
1160
|
it,
|
1119
1161
|
init_null_count,
|
1120
1162
|
first_value,
|
1121
|
-
self.name(),
|
1163
|
+
self.name().clone(),
|
1122
1164
|
self.len(),
|
1123
1165
|
))
|
1124
1166
|
}
|
@@ -11,9 +11,9 @@ use polars_core::prelude::AnyValue;
|
|
11
11
|
use crate::prelude::ObjectValue;
|
12
12
|
use crate::Wrap;
|
13
13
|
|
14
|
-
pub(crate) fn
|
14
|
+
pub(crate) fn register_startup_deps() {
|
15
15
|
if !registry::is_object_builder_registered() {
|
16
|
-
let object_builder = Box::new(|name:
|
16
|
+
let object_builder = Box::new(|name: PlSmallStr, capacity: usize| {
|
17
17
|
Box::new(ObjectChunkedBuilder::<ObjectValue>::new(name, capacity))
|
18
18
|
as Box<dyn AnonymousObjectBuilder>
|
19
19
|
});
|
@@ -98,11 +98,7 @@ impl RbSeries {
|
|
98
98
|
.into_value())
|
99
99
|
}
|
100
100
|
|
101
|
-
pub fn quantile(
|
102
|
-
&self,
|
103
|
-
quantile: f64,
|
104
|
-
interpolation: Wrap<QuantileInterpolOptions>,
|
105
|
-
) -> RbResult<Value> {
|
101
|
+
pub fn quantile(&self, quantile: f64, interpolation: Wrap<QuantileMethod>) -> RbResult<Value> {
|
106
102
|
let bind = self
|
107
103
|
.series
|
108
104
|
.borrow()
|
@@ -2,33 +2,33 @@ use crate::{RbPolarsErr, RbResult, RbSeries};
|
|
2
2
|
|
3
3
|
impl RbSeries {
|
4
4
|
pub fn add(&self, other: &RbSeries) -> RbResult<Self> {
|
5
|
-
(&*self.series.borrow() + &*other.series.borrow())
|
5
|
+
Ok((&*self.series.borrow() + &*other.series.borrow())
|
6
6
|
.map(Into::into)
|
7
|
-
.map_err(RbPolarsErr::from)
|
7
|
+
.map_err(RbPolarsErr::from)?)
|
8
8
|
}
|
9
9
|
|
10
10
|
pub fn sub(&self, other: &RbSeries) -> RbResult<Self> {
|
11
|
-
(&*self.series.borrow() - &*other.series.borrow())
|
11
|
+
Ok((&*self.series.borrow() - &*other.series.borrow())
|
12
12
|
.map(Into::into)
|
13
|
-
.map_err(RbPolarsErr::from)
|
13
|
+
.map_err(RbPolarsErr::from)?)
|
14
14
|
}
|
15
15
|
|
16
16
|
pub fn mul(&self, other: &RbSeries) -> RbResult<Self> {
|
17
|
-
(&*self.series.borrow() * &*other.series.borrow())
|
17
|
+
Ok((&*self.series.borrow() * &*other.series.borrow())
|
18
18
|
.map(Into::into)
|
19
|
-
.map_err(RbPolarsErr::from)
|
19
|
+
.map_err(RbPolarsErr::from)?)
|
20
20
|
}
|
21
21
|
|
22
22
|
pub fn div(&self, other: &RbSeries) -> RbResult<Self> {
|
23
|
-
(&*self.series.borrow() / &*other.series.borrow())
|
23
|
+
Ok((&*self.series.borrow() / &*other.series.borrow())
|
24
24
|
.map(Into::into)
|
25
|
-
.map_err(RbPolarsErr::from)
|
25
|
+
.map_err(RbPolarsErr::from)?)
|
26
26
|
}
|
27
27
|
|
28
28
|
pub fn rem(&self, other: &RbSeries) -> RbResult<Self> {
|
29
|
-
(&*self.series.borrow() % &*other.series.borrow())
|
29
|
+
Ok((&*self.series.borrow() % &*other.series.borrow())
|
30
30
|
.map(Into::into)
|
31
|
-
.map_err(RbPolarsErr::from)
|
31
|
+
.map_err(RbPolarsErr::from)?)
|
32
32
|
}
|
33
33
|
}
|
34
34
|
|