polars-df 0.2.5-x86_64-darwin → 0.3.0-x86_64-darwin
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +8 -0
- data/Cargo.lock +290 -137
- data/Cargo.toml +1 -1
- data/LICENSE-THIRD-PARTY.txt +894 -486
- data/lib/polars/3.0/polars.bundle +0 -0
- data/lib/polars/3.1/polars.bundle +0 -0
- data/lib/polars/3.2/polars.bundle +0 -0
- data/lib/polars/cat_expr.rb +0 -4
- data/lib/polars/cat_name_space.rb +0 -4
- data/lib/polars/convert.rb +0 -7
- data/lib/polars/data_frame.rb +139 -204
- data/lib/polars/date_time_expr.rb +19 -151
- data/lib/polars/date_time_name_space.rb +17 -17
- data/lib/polars/expr.rb +68 -315
- data/lib/polars/group_by.rb +68 -51
- data/lib/polars/io.rb +1 -1
- data/lib/polars/lazy_frame.rb +1 -103
- data/lib/polars/lazy_functions.rb +0 -26
- data/lib/polars/lazy_group_by.rb +0 -8
- data/lib/polars/list_expr.rb +5 -27
- data/lib/polars/list_name_space.rb +5 -8
- data/lib/polars/series.rb +20 -16
- data/lib/polars/string_expr.rb +20 -76
- data/lib/polars/string_name_space.rb +5 -15
- data/lib/polars/struct_expr.rb +0 -2
- data/lib/polars/version.rb +1 -1
- metadata +2 -2
data/lib/polars/expr.rb
CHANGED
@@ -167,11 +167,8 @@ module Polars
|
|
167
167
|
# # │ cat ┆ u32 │
|
168
168
|
# # ╞══════╪═══════════════╡
|
169
169
|
# # │ a ┆ 0 │
|
170
|
-
# # ├╌╌╌╌╌╌┼╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌┤
|
171
170
|
# # │ x ┆ 1 │
|
172
|
-
# # ├╌╌╌╌╌╌┼╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌┤
|
173
171
|
# # │ null ┆ null │
|
174
|
-
# # ├╌╌╌╌╌╌┼╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌┤
|
175
172
|
# # │ a ┆ 0 │
|
176
173
|
# # └──────┴───────────────┘
|
177
174
|
def to_physical
|
@@ -238,9 +235,7 @@ module Polars
|
|
238
235
|
# # │ f64 │
|
239
236
|
# # ╞══════════╡
|
240
237
|
# # │ 1.0 │
|
241
|
-
# # ├╌╌╌╌╌╌╌╌╌╌┤
|
242
238
|
# # │ 1.414214 │
|
243
|
-
# # ├╌╌╌╌╌╌╌╌╌╌┤
|
244
239
|
# # │ 2.0 │
|
245
240
|
# # └──────────┘
|
246
241
|
def sqrt
|
@@ -262,9 +257,7 @@ module Polars
|
|
262
257
|
# # │ f64 │
|
263
258
|
# # ╞═════════╡
|
264
259
|
# # │ 0.0 │
|
265
|
-
# # ├╌╌╌╌╌╌╌╌╌┤
|
266
260
|
# # │ 0.30103 │
|
267
|
-
# # ├╌╌╌╌╌╌╌╌╌┤
|
268
261
|
# # │ 0.60206 │
|
269
262
|
# # └─────────┘
|
270
263
|
def log10
|
@@ -286,9 +279,7 @@ module Polars
|
|
286
279
|
# # │ f64 │
|
287
280
|
# # ╞══════════╡
|
288
281
|
# # │ 2.718282 │
|
289
|
-
# # ├╌╌╌╌╌╌╌╌╌╌┤
|
290
282
|
# # │ 7.389056 │
|
291
|
-
# # ├╌╌╌╌╌╌╌╌╌╌┤
|
292
283
|
# # │ 54.59815 │
|
293
284
|
# # └──────────┘
|
294
285
|
def exp
|
@@ -323,9 +314,7 @@ module Polars
|
|
323
314
|
# # │ i64 ┆ str │
|
324
315
|
# # ╞═════╪══════╡
|
325
316
|
# # │ 1 ┆ a │
|
326
|
-
# # ├╌╌╌╌╌┼╌╌╌╌╌╌┤
|
327
317
|
# # │ 2 ┆ b │
|
328
|
-
# # ├╌╌╌╌╌┼╌╌╌╌╌╌┤
|
329
318
|
# # │ 3 ┆ null │
|
330
319
|
# # └─────┴──────┘
|
331
320
|
def alias(name)
|
@@ -366,9 +355,7 @@ module Polars
|
|
366
355
|
# # │ i64 ┆ f64 │
|
367
356
|
# # ╞═════╪══════╡
|
368
357
|
# # │ 1 ┆ null │
|
369
|
-
# # ├╌╌╌╌╌┼╌╌╌╌╌╌┤
|
370
358
|
# # │ 2 ┆ 2.5 │
|
371
|
-
# # ├╌╌╌╌╌┼╌╌╌╌╌╌┤
|
372
359
|
# # │ 3 ┆ 1.5 │
|
373
360
|
# # └─────┴──────┘
|
374
361
|
def exclude(columns)
|
@@ -411,7 +398,6 @@ module Polars
|
|
411
398
|
# # │ i64 ┆ i64 │
|
412
399
|
# # ╞═════╪═════╡
|
413
400
|
# # │ 9 ┆ 3 │
|
414
|
-
# # ├╌╌╌╌╌┼╌╌╌╌╌┤
|
415
401
|
# # │ 18 ┆ 4 │
|
416
402
|
# # └─────┴─────┘
|
417
403
|
def keep_name
|
@@ -454,7 +440,6 @@ module Polars
|
|
454
440
|
# # │ i64 ┆ i64 │
|
455
441
|
# # ╞═══════════╪═══════════╡
|
456
442
|
# # │ 2 ┆ 4 │
|
457
|
-
# # ├╌╌╌╌╌╌╌╌╌╌╌┼╌╌╌╌╌╌╌╌╌╌╌┤
|
458
443
|
# # │ 1 ┆ 3 │
|
459
444
|
# # └───────────┴───────────┘
|
460
445
|
def map_alias(&f)
|
@@ -480,9 +465,7 @@ module Polars
|
|
480
465
|
# # │ bool ┆ str │
|
481
466
|
# # ╞═══════╪══════╡
|
482
467
|
# # │ true ┆ a │
|
483
|
-
# # ├╌╌╌╌╌╌╌┼╌╌╌╌╌╌┤
|
484
468
|
# # │ false ┆ b │
|
485
|
-
# # ├╌╌╌╌╌╌╌┼╌╌╌╌╌╌┤
|
486
469
|
# # │ false ┆ null │
|
487
470
|
# # └───────┴──────┘
|
488
471
|
#
|
@@ -496,9 +479,7 @@ module Polars
|
|
496
479
|
# # │ bool │
|
497
480
|
# # ╞═══════╡
|
498
481
|
# # │ false │
|
499
|
-
# # ├╌╌╌╌╌╌╌┤
|
500
482
|
# # │ true │
|
501
|
-
# # ├╌╌╌╌╌╌╌┤
|
502
483
|
# # │ true │
|
503
484
|
# # └───────┘
|
504
485
|
def is_not
|
@@ -525,13 +506,9 @@ module Polars
|
|
525
506
|
# # │ i64 ┆ f64 ┆ bool ┆ bool │
|
526
507
|
# # ╞══════╪═════╪══════════╪══════════╡
|
527
508
|
# # │ 1 ┆ 1.0 ┆ false ┆ false │
|
528
|
-
# # ├╌╌╌╌╌╌┼╌╌╌╌╌┼╌╌╌╌╌╌╌╌╌╌┼╌╌╌╌╌╌╌╌╌╌┤
|
529
509
|
# # │ 2 ┆ 2.0 ┆ false ┆ false │
|
530
|
-
# # ├╌╌╌╌╌╌┼╌╌╌╌╌┼╌╌╌╌╌╌╌╌╌╌┼╌╌╌╌╌╌╌╌╌╌┤
|
531
510
|
# # │ null ┆ NaN ┆ true ┆ false │
|
532
|
-
# # ├╌╌╌╌╌╌┼╌╌╌╌╌┼╌╌╌╌╌╌╌╌╌╌┼╌╌╌╌╌╌╌╌╌╌┤
|
533
511
|
# # │ 1 ┆ 1.0 ┆ false ┆ false │
|
534
|
-
# # ├╌╌╌╌╌╌┼╌╌╌╌╌┼╌╌╌╌╌╌╌╌╌╌┼╌╌╌╌╌╌╌╌╌╌┤
|
535
512
|
# # │ 5 ┆ 5.0 ┆ false ┆ false │
|
536
513
|
# # └──────┴─────┴──────────┴──────────┘
|
537
514
|
def is_null
|
@@ -558,13 +535,9 @@ module Polars
|
|
558
535
|
# # │ i64 ┆ f64 ┆ bool ┆ bool │
|
559
536
|
# # ╞══════╪═════╪════════════╪════════════╡
|
560
537
|
# # │ 1 ┆ 1.0 ┆ true ┆ true │
|
561
|
-
# # ├╌╌╌╌╌╌┼╌╌╌╌╌┼╌╌╌╌╌╌╌╌╌╌╌╌┼╌╌╌╌╌╌╌╌╌╌╌╌┤
|
562
538
|
# # │ 2 ┆ 2.0 ┆ true ┆ true │
|
563
|
-
# # ├╌╌╌╌╌╌┼╌╌╌╌╌┼╌╌╌╌╌╌╌╌╌╌╌╌┼╌╌╌╌╌╌╌╌╌╌╌╌┤
|
564
539
|
# # │ null ┆ NaN ┆ false ┆ true │
|
565
|
-
# # ├╌╌╌╌╌╌┼╌╌╌╌╌┼╌╌╌╌╌╌╌╌╌╌╌╌┼╌╌╌╌╌╌╌╌╌╌╌╌┤
|
566
540
|
# # │ 1 ┆ 1.0 ┆ true ┆ true │
|
567
|
-
# # ├╌╌╌╌╌╌┼╌╌╌╌╌┼╌╌╌╌╌╌╌╌╌╌╌╌┼╌╌╌╌╌╌╌╌╌╌╌╌┤
|
568
541
|
# # │ 5 ┆ 5.0 ┆ true ┆ true │
|
569
542
|
# # └──────┴─────┴────────────┴────────────┘
|
570
543
|
def is_not_null
|
@@ -591,7 +564,6 @@ module Polars
|
|
591
564
|
# # │ bool ┆ bool │
|
592
565
|
# # ╞══════╪═══════╡
|
593
566
|
# # │ true ┆ true │
|
594
|
-
# # ├╌╌╌╌╌╌┼╌╌╌╌╌╌╌┤
|
595
567
|
# # │ true ┆ false │
|
596
568
|
# # └──────┴───────┘
|
597
569
|
def is_finite
|
@@ -618,7 +590,6 @@ module Polars
|
|
618
590
|
# # │ bool ┆ bool │
|
619
591
|
# # ╞═══════╪═══════╡
|
620
592
|
# # │ false ┆ false │
|
621
|
-
# # ├╌╌╌╌╌╌╌┼╌╌╌╌╌╌╌┤
|
622
593
|
# # │ false ┆ true │
|
623
594
|
# # └───────┴───────┘
|
624
595
|
def is_infinite
|
@@ -649,13 +620,9 @@ module Polars
|
|
649
620
|
# # │ i64 ┆ f64 ┆ bool │
|
650
621
|
# # ╞══════╪═════╪═════════╡
|
651
622
|
# # │ 1 ┆ 1.0 ┆ false │
|
652
|
-
# # ├╌╌╌╌╌╌┼╌╌╌╌╌┼╌╌╌╌╌╌╌╌╌┤
|
653
623
|
# # │ 2 ┆ 2.0 ┆ false │
|
654
|
-
# # ├╌╌╌╌╌╌┼╌╌╌╌╌┼╌╌╌╌╌╌╌╌╌┤
|
655
624
|
# # │ null ┆ NaN ┆ true │
|
656
|
-
# # ├╌╌╌╌╌╌┼╌╌╌╌╌┼╌╌╌╌╌╌╌╌╌┤
|
657
625
|
# # │ 1 ┆ 1.0 ┆ false │
|
658
|
-
# # ├╌╌╌╌╌╌┼╌╌╌╌╌┼╌╌╌╌╌╌╌╌╌┤
|
659
626
|
# # │ 5 ┆ 5.0 ┆ false │
|
660
627
|
# # └──────┴─────┴─────────┘
|
661
628
|
def is_nan
|
@@ -686,13 +653,9 @@ module Polars
|
|
686
653
|
# # │ i64 ┆ f64 ┆ bool │
|
687
654
|
# # ╞══════╪═════╪══════════════╡
|
688
655
|
# # │ 1 ┆ 1.0 ┆ true │
|
689
|
-
# # ├╌╌╌╌╌╌┼╌╌╌╌╌┼╌╌╌╌╌╌╌╌╌╌╌╌╌╌┤
|
690
656
|
# # │ 2 ┆ 2.0 ┆ true │
|
691
|
-
# # ├╌╌╌╌╌╌┼╌╌╌╌╌┼╌╌╌╌╌╌╌╌╌╌╌╌╌╌┤
|
692
657
|
# # │ null ┆ NaN ┆ false │
|
693
|
-
# # ├╌╌╌╌╌╌┼╌╌╌╌╌┼╌╌╌╌╌╌╌╌╌╌╌╌╌╌┤
|
694
658
|
# # │ 1 ┆ 1.0 ┆ true │
|
695
|
-
# # ├╌╌╌╌╌╌┼╌╌╌╌╌┼╌╌╌╌╌╌╌╌╌╌╌╌╌╌┤
|
696
659
|
# # │ 5 ┆ 5.0 ┆ true │
|
697
660
|
# # └──────┴─────┴──────────────┘
|
698
661
|
def is_not_nan
|
@@ -728,7 +691,6 @@ module Polars
|
|
728
691
|
# # │ str ┆ list[u32] │
|
729
692
|
# # ╞═══════╪═══════════╡
|
730
693
|
# # │ one ┆ [0, 1, 2] │
|
731
|
-
# # ├╌╌╌╌╌╌╌┼╌╌╌╌╌╌╌╌╌╌╌┤
|
732
694
|
# # │ two ┆ [3, 4, 5] │
|
733
695
|
# # └───────┴───────────┘
|
734
696
|
def agg_groups
|
@@ -803,7 +765,6 @@ module Polars
|
|
803
765
|
# # │ i64 ┆ i64 │
|
804
766
|
# # ╞═════╪═════╡
|
805
767
|
# # │ 9 ┆ 4 │
|
806
|
-
# # ├╌╌╌╌╌┼╌╌╌╌╌┤
|
807
768
|
# # │ 10 ┆ 4 │
|
808
769
|
# # └─────┴─────┘
|
809
770
|
def slice(offset, length = nil)
|
@@ -843,7 +804,6 @@ module Polars
|
|
843
804
|
# # │ i64 ┆ i64 │
|
844
805
|
# # ╞═════╪══════╡
|
845
806
|
# # │ 8 ┆ null │
|
846
|
-
# # ├╌╌╌╌╌┼╌╌╌╌╌╌┤
|
847
807
|
# # │ 10 ┆ 4 │
|
848
808
|
# # └─────┴──────┘
|
849
809
|
def append(other, upcast: true)
|
@@ -866,15 +826,10 @@ module Polars
|
|
866
826
|
# # │ i64 │
|
867
827
|
# # ╞═════════╡
|
868
828
|
# # │ null │
|
869
|
-
# # ├╌╌╌╌╌╌╌╌╌┤
|
870
829
|
# # │ null │
|
871
|
-
# # ├╌╌╌╌╌╌╌╌╌┤
|
872
830
|
# # │ null │
|
873
|
-
# # ├╌╌╌╌╌╌╌╌╌┤
|
874
831
|
# # │ 1 │
|
875
|
-
# # ├╌╌╌╌╌╌╌╌╌┤
|
876
832
|
# # │ 1 │
|
877
|
-
# # ├╌╌╌╌╌╌╌╌╌┤
|
878
833
|
# # │ 2 │
|
879
834
|
# # └─────────┘
|
880
835
|
def rechunk
|
@@ -901,9 +856,7 @@ module Polars
|
|
901
856
|
# # │ f64 │
|
902
857
|
# # ╞═════╡
|
903
858
|
# # │ 4.0 │
|
904
|
-
# # ├╌╌╌╌╌┤
|
905
859
|
# # │ 4.0 │
|
906
|
-
# # ├╌╌╌╌╌┤
|
907
860
|
# # │ NaN │
|
908
861
|
# # └─────┘
|
909
862
|
def drop_nulls
|
@@ -930,9 +883,7 @@ module Polars
|
|
930
883
|
# # │ f64 │
|
931
884
|
# # ╞══════╡
|
932
885
|
# # │ null │
|
933
|
-
# # ├╌╌╌╌╌╌┤
|
934
886
|
# # │ 4.0 │
|
935
|
-
# # ├╌╌╌╌╌╌┤
|
936
887
|
# # │ 4.0 │
|
937
888
|
# # └──────┘
|
938
889
|
def drop_nans
|
@@ -966,11 +917,8 @@ module Polars
|
|
966
917
|
# # │ i64 ┆ i64 │
|
967
918
|
# # ╞═════╪═══════════╡
|
968
919
|
# # │ 1 ┆ 10 │
|
969
|
-
# # ├╌╌╌╌╌┼╌╌╌╌╌╌╌╌╌╌╌┤
|
970
920
|
# # │ 3 ┆ 9 │
|
971
|
-
# # ├╌╌╌╌╌┼╌╌╌╌╌╌╌╌╌╌╌┤
|
972
921
|
# # │ 6 ┆ 7 │
|
973
|
-
# # ├╌╌╌╌╌┼╌╌╌╌╌╌╌╌╌╌╌┤
|
974
922
|
# # │ 10 ┆ 4 │
|
975
923
|
# # └─────┴───────────┘
|
976
924
|
def cumsum(reverse: false)
|
@@ -1004,11 +952,8 @@ module Polars
|
|
1004
952
|
# # │ i64 ┆ i64 │
|
1005
953
|
# # ╞═════╪═══════════╡
|
1006
954
|
# # │ 1 ┆ 24 │
|
1007
|
-
# # ├╌╌╌╌╌┼╌╌╌╌╌╌╌╌╌╌╌┤
|
1008
955
|
# # │ 2 ┆ 24 │
|
1009
|
-
# # ├╌╌╌╌╌┼╌╌╌╌╌╌╌╌╌╌╌┤
|
1010
956
|
# # │ 6 ┆ 12 │
|
1011
|
-
# # ├╌╌╌╌╌┼╌╌╌╌╌╌╌╌╌╌╌┤
|
1012
957
|
# # │ 24 ┆ 4 │
|
1013
958
|
# # └─────┴───────────┘
|
1014
959
|
def cumprod(reverse: false)
|
@@ -1038,11 +983,8 @@ module Polars
|
|
1038
983
|
# # │ i64 ┆ i64 │
|
1039
984
|
# # ╞═════╪═══════════╡
|
1040
985
|
# # │ 1 ┆ 1 │
|
1041
|
-
# # ├╌╌╌╌╌┼╌╌╌╌╌╌╌╌╌╌╌┤
|
1042
986
|
# # │ 1 ┆ 2 │
|
1043
|
-
# # ├╌╌╌╌╌┼╌╌╌╌╌╌╌╌╌╌╌┤
|
1044
987
|
# # │ 1 ┆ 3 │
|
1045
|
-
# # ├╌╌╌╌╌┼╌╌╌╌╌╌╌╌╌╌╌┤
|
1046
988
|
# # │ 1 ┆ 4 │
|
1047
989
|
# # └─────┴───────────┘
|
1048
990
|
def cummin(reverse: false)
|
@@ -1072,11 +1014,8 @@ module Polars
|
|
1072
1014
|
# # │ i64 ┆ i64 │
|
1073
1015
|
# # ╞═════╪═══════════╡
|
1074
1016
|
# # │ 1 ┆ 4 │
|
1075
|
-
# # ├╌╌╌╌╌┼╌╌╌╌╌╌╌╌╌╌╌┤
|
1076
1017
|
# # │ 2 ┆ 4 │
|
1077
|
-
# # ├╌╌╌╌╌┼╌╌╌╌╌╌╌╌╌╌╌┤
|
1078
1018
|
# # │ 3 ┆ 4 │
|
1079
|
-
# # ├╌╌╌╌╌┼╌╌╌╌╌╌╌╌╌╌╌┤
|
1080
1019
|
# # │ 4 ┆ 4 │
|
1081
1020
|
# # └─────┴───────────┘
|
1082
1021
|
def cummax(reverse: false)
|
@@ -1108,11 +1047,8 @@ module Polars
|
|
1108
1047
|
# # │ u32 ┆ u32 │
|
1109
1048
|
# # ╞═════╪═══════════╡
|
1110
1049
|
# # │ 0 ┆ 3 │
|
1111
|
-
# # ├╌╌╌╌╌┼╌╌╌╌╌╌╌╌╌╌╌┤
|
1112
1050
|
# # │ 1 ┆ 2 │
|
1113
|
-
# # ├╌╌╌╌╌┼╌╌╌╌╌╌╌╌╌╌╌┤
|
1114
1051
|
# # │ 2 ┆ 1 │
|
1115
|
-
# # ├╌╌╌╌╌┼╌╌╌╌╌╌╌╌╌╌╌┤
|
1116
1052
|
# # │ 3 ┆ 0 │
|
1117
1053
|
# # └─────┴───────────┘
|
1118
1054
|
def cumcount(reverse: false)
|
@@ -1136,11 +1072,8 @@ module Polars
|
|
1136
1072
|
# # │ f64 │
|
1137
1073
|
# # ╞═════╡
|
1138
1074
|
# # │ 0.0 │
|
1139
|
-
# # ├╌╌╌╌╌┤
|
1140
1075
|
# # │ 0.0 │
|
1141
|
-
# # ├╌╌╌╌╌┤
|
1142
1076
|
# # │ 1.0 │
|
1143
|
-
# # ├╌╌╌╌╌┤
|
1144
1077
|
# # │ 1.0 │
|
1145
1078
|
# # └─────┘
|
1146
1079
|
def floor
|
@@ -1164,11 +1097,8 @@ module Polars
|
|
1164
1097
|
# # │ f64 │
|
1165
1098
|
# # ╞═════╡
|
1166
1099
|
# # │ 1.0 │
|
1167
|
-
# # ├╌╌╌╌╌┤
|
1168
1100
|
# # │ 1.0 │
|
1169
|
-
# # ├╌╌╌╌╌┤
|
1170
1101
|
# # │ 1.0 │
|
1171
|
-
# # ├╌╌╌╌╌┤
|
1172
1102
|
# # │ 2.0 │
|
1173
1103
|
# # └─────┘
|
1174
1104
|
def ceil
|
@@ -1193,11 +1123,8 @@ module Polars
|
|
1193
1123
|
# # │ f64 │
|
1194
1124
|
# # ╞═════╡
|
1195
1125
|
# # │ 0.3 │
|
1196
|
-
# # ├╌╌╌╌╌┤
|
1197
1126
|
# # │ 0.5 │
|
1198
|
-
# # ├╌╌╌╌╌┤
|
1199
1127
|
# # │ 1.0 │
|
1200
|
-
# # ├╌╌╌╌╌┤
|
1201
1128
|
# # │ 1.2 │
|
1202
1129
|
# # └─────┘
|
1203
1130
|
def round(decimals = 0)
|
@@ -1255,7 +1182,6 @@ module Polars
|
|
1255
1182
|
# # │ i64 ┆ i64 │
|
1256
1183
|
# # ╞═════╪═════╡
|
1257
1184
|
# # │ 1 ┆ 1 │
|
1258
|
-
# # ├╌╌╌╌╌┼╌╌╌╌╌┤
|
1259
1185
|
# # │ 1 ┆ 2 │
|
1260
1186
|
# # └─────┴─────┘
|
1261
1187
|
def mode
|
@@ -1293,9 +1219,7 @@ module Polars
|
|
1293
1219
|
# # │ f64 ┆ i32 │
|
1294
1220
|
# # ╞═════╪═════╡
|
1295
1221
|
# # │ 1.0 ┆ 4 │
|
1296
|
-
# # ├╌╌╌╌╌┼╌╌╌╌╌┤
|
1297
1222
|
# # │ 2.0 ┆ 5 │
|
1298
|
-
# # ├╌╌╌╌╌┼╌╌╌╌╌┤
|
1299
1223
|
# # │ 3.0 ┆ 6 │
|
1300
1224
|
# # └─────┴─────┘
|
1301
1225
|
def cast(dtype, strict: true)
|
@@ -1338,15 +1262,10 @@ module Polars
|
|
1338
1262
|
# # │ i64 │
|
1339
1263
|
# # ╞═══════╡
|
1340
1264
|
# # │ 1 │
|
1341
|
-
# # ├╌╌╌╌╌╌╌┤
|
1342
1265
|
# # │ 2 │
|
1343
|
-
# # ├╌╌╌╌╌╌╌┤
|
1344
1266
|
# # │ 3 │
|
1345
|
-
# # ├╌╌╌╌╌╌╌┤
|
1346
1267
|
# # │ 4 │
|
1347
|
-
# # ├╌╌╌╌╌╌╌┤
|
1348
1268
|
# # │ 98 │
|
1349
|
-
# # ├╌╌╌╌╌╌╌┤
|
1350
1269
|
# # │ 99 │
|
1351
1270
|
# # └───────┘
|
1352
1271
|
#
|
@@ -1360,15 +1279,10 @@ module Polars
|
|
1360
1279
|
# # │ i64 │
|
1361
1280
|
# # ╞═══════╡
|
1362
1281
|
# # │ 1 │
|
1363
|
-
# # ├╌╌╌╌╌╌╌┤
|
1364
1282
|
# # │ 2 │
|
1365
|
-
# # ├╌╌╌╌╌╌╌┤
|
1366
1283
|
# # │ 3 │
|
1367
|
-
# # ├╌╌╌╌╌╌╌┤
|
1368
1284
|
# # │ 4 │
|
1369
|
-
# # ├╌╌╌╌╌╌╌┤
|
1370
1285
|
# # │ 98 │
|
1371
|
-
# # ├╌╌╌╌╌╌╌┤
|
1372
1286
|
# # │ 99 │
|
1373
1287
|
# # └───────┘
|
1374
1288
|
#
|
@@ -1382,7 +1296,6 @@ module Polars
|
|
1382
1296
|
# # │ str ┆ list[i64] │
|
1383
1297
|
# # ╞═══════╪════════════╡
|
1384
1298
|
# # │ two ┆ [3, 4, 99] │
|
1385
|
-
# # ├╌╌╌╌╌╌╌┼╌╌╌╌╌╌╌╌╌╌╌╌┤
|
1386
1299
|
# # │ one ┆ [1, 2, 98] │
|
1387
1300
|
# # └───────┴────────────┘
|
1388
1301
|
def sort(reverse: false, nulls_last: false)
|
@@ -1420,13 +1333,9 @@ module Polars
|
|
1420
1333
|
# # │ i64 ┆ i64 │
|
1421
1334
|
# # ╞═══════╪══════════╡
|
1422
1335
|
# # │ 99 ┆ 1 │
|
1423
|
-
# # ├╌╌╌╌╌╌╌┼╌╌╌╌╌╌╌╌╌╌┤
|
1424
1336
|
# # │ 98 ┆ 2 │
|
1425
|
-
# # ├╌╌╌╌╌╌╌┼╌╌╌╌╌╌╌╌╌╌┤
|
1426
1337
|
# # │ 4 ┆ 3 │
|
1427
|
-
# # ├╌╌╌╌╌╌╌┼╌╌╌╌╌╌╌╌╌╌┤
|
1428
1338
|
# # │ 3 ┆ 4 │
|
1429
|
-
# # ├╌╌╌╌╌╌╌┼╌╌╌╌╌╌╌╌╌╌┤
|
1430
1339
|
# # │ 2 ┆ 98 │
|
1431
1340
|
# # └───────┴──────────┘
|
1432
1341
|
def top_k(k: 5, reverse: false)
|
@@ -1457,9 +1366,7 @@ module Polars
|
|
1457
1366
|
# # │ u32 │
|
1458
1367
|
# # ╞═════╡
|
1459
1368
|
# # │ 1 │
|
1460
|
-
# # ├╌╌╌╌╌┤
|
1461
1369
|
# # │ 0 │
|
1462
|
-
# # ├╌╌╌╌╌┤
|
1463
1370
|
# # │ 2 │
|
1464
1371
|
# # └─────┘
|
1465
1372
|
def arg_sort(reverse: false, nulls_last: false)
|
@@ -1543,9 +1450,9 @@ module Polars
|
|
1543
1450
|
# # ╞══════╪═══════╪═════╡
|
1544
1451
|
# # │ 0 ┆ 2 ┆ 4 │
|
1545
1452
|
# # └──────┴───────┴─────┘
|
1546
|
-
def search_sorted(element)
|
1453
|
+
def search_sorted(element, side: "any")
|
1547
1454
|
element = Utils.expr_to_lit_or_expr(element, str_to_lit: false)
|
1548
|
-
wrap_expr(_rbexpr.search_sorted(element._rbexpr))
|
1455
|
+
wrap_expr(_rbexpr.search_sorted(element._rbexpr, side))
|
1549
1456
|
end
|
1550
1457
|
|
1551
1458
|
# Sort this column by the ordering of another column, or multiple other columns.
|
@@ -1584,15 +1491,10 @@ module Polars
|
|
1584
1491
|
# # │ str │
|
1585
1492
|
# # ╞═══════╡
|
1586
1493
|
# # │ one │
|
1587
|
-
# # ├╌╌╌╌╌╌╌┤
|
1588
1494
|
# # │ one │
|
1589
|
-
# # ├╌╌╌╌╌╌╌┤
|
1590
1495
|
# # │ two │
|
1591
|
-
# # ├╌╌╌╌╌╌╌┤
|
1592
1496
|
# # │ two │
|
1593
|
-
# # ├╌╌╌╌╌╌╌┤
|
1594
1497
|
# # │ one │
|
1595
|
-
# # ├╌╌╌╌╌╌╌┤
|
1596
1498
|
# # │ two │
|
1597
1499
|
# # └───────┘
|
1598
1500
|
def sort_by(by, reverse: false)
|
@@ -1637,7 +1539,6 @@ module Polars
|
|
1637
1539
|
# # │ str ┆ i64 │
|
1638
1540
|
# # ╞═══════╪═══════╡
|
1639
1541
|
# # │ one ┆ 98 │
|
1640
|
-
# # ├╌╌╌╌╌╌╌┼╌╌╌╌╌╌╌┤
|
1641
1542
|
# # │ two ┆ 99 │
|
1642
1543
|
# # └───────┴───────┘
|
1643
1544
|
def take(indices)
|
@@ -1667,11 +1568,8 @@ module Polars
|
|
1667
1568
|
# # │ i64 │
|
1668
1569
|
# # ╞══════╡
|
1669
1570
|
# # │ null │
|
1670
|
-
# # ├╌╌╌╌╌╌┤
|
1671
1571
|
# # │ 1 │
|
1672
|
-
# # ├╌╌╌╌╌╌┤
|
1673
1572
|
# # │ 2 │
|
1674
|
-
# # ├╌╌╌╌╌╌┤
|
1675
1573
|
# # │ 3 │
|
1676
1574
|
# # └──────┘
|
1677
1575
|
def shift(periods = 1)
|
@@ -1698,11 +1596,8 @@ module Polars
|
|
1698
1596
|
# # │ str │
|
1699
1597
|
# # ╞═════╡
|
1700
1598
|
# # │ a │
|
1701
|
-
# # ├╌╌╌╌╌┤
|
1702
1599
|
# # │ 1 │
|
1703
|
-
# # ├╌╌╌╌╌┤
|
1704
1600
|
# # │ 2 │
|
1705
|
-
# # ├╌╌╌╌╌┤
|
1706
1601
|
# # │ 3 │
|
1707
1602
|
# # └─────┘
|
1708
1603
|
def shift_and_fill(periods, fill_value)
|
@@ -1740,9 +1635,7 @@ module Polars
|
|
1740
1635
|
# # │ i64 ┆ i64 │
|
1741
1636
|
# # ╞═════╪═════╡
|
1742
1637
|
# # │ 1 ┆ 4 │
|
1743
|
-
# # ├╌╌╌╌╌┼╌╌╌╌╌┤
|
1744
1638
|
# # │ 2 ┆ 0 │
|
1745
|
-
# # ├╌╌╌╌╌┼╌╌╌╌╌┤
|
1746
1639
|
# # │ 0 ┆ 6 │
|
1747
1640
|
# # └─────┴─────┘
|
1748
1641
|
#
|
@@ -1756,9 +1649,7 @@ module Polars
|
|
1756
1649
|
# # │ i64 ┆ i64 │
|
1757
1650
|
# # ╞═════╪═════╡
|
1758
1651
|
# # │ 1 ┆ 4 │
|
1759
|
-
# # ├╌╌╌╌╌┼╌╌╌╌╌┤
|
1760
1652
|
# # │ 2 ┆ 99 │
|
1761
|
-
# # ├╌╌╌╌╌┼╌╌╌╌╌┤
|
1762
1653
|
# # │ 99 ┆ 6 │
|
1763
1654
|
# # └─────┴─────┘
|
1764
1655
|
#
|
@@ -1772,9 +1663,7 @@ module Polars
|
|
1772
1663
|
# # │ i64 ┆ i64 │
|
1773
1664
|
# # ╞═════╪═════╡
|
1774
1665
|
# # │ 1 ┆ 4 │
|
1775
|
-
# # ├╌╌╌╌╌┼╌╌╌╌╌┤
|
1776
1666
|
# # │ 2 ┆ 4 │
|
1777
|
-
# # ├╌╌╌╌╌┼╌╌╌╌╌┤
|
1778
1667
|
# # │ 2 ┆ 6 │
|
1779
1668
|
# # └─────┴─────┘
|
1780
1669
|
def fill_null(value = nil, strategy: nil, limit: nil)
|
@@ -1814,9 +1703,7 @@ module Polars
|
|
1814
1703
|
# # │ str ┆ str │
|
1815
1704
|
# # ╞══════╪══════╡
|
1816
1705
|
# # │ 1.0 ┆ 4.0 │
|
1817
|
-
# # ├╌╌╌╌╌╌┼╌╌╌╌╌╌┤
|
1818
1706
|
# # │ null ┆ zero │
|
1819
|
-
# # ├╌╌╌╌╌╌┼╌╌╌╌╌╌┤
|
1820
1707
|
# # │ zero ┆ 6.0 │
|
1821
1708
|
# # └──────┴──────┘
|
1822
1709
|
def fill_nan(fill_value)
|
@@ -1847,9 +1734,7 @@ module Polars
|
|
1847
1734
|
# # │ i64 ┆ i64 │
|
1848
1735
|
# # ╞═════╪═════╡
|
1849
1736
|
# # │ 1 ┆ 4 │
|
1850
|
-
# # ├╌╌╌╌╌┼╌╌╌╌╌┤
|
1851
1737
|
# # │ 2 ┆ 4 │
|
1852
|
-
# # ├╌╌╌╌╌┼╌╌╌╌╌┤
|
1853
1738
|
# # │ 2 ┆ 6 │
|
1854
1739
|
# # └─────┴─────┘
|
1855
1740
|
def forward_fill(limit: nil)
|
@@ -1879,9 +1764,7 @@ module Polars
|
|
1879
1764
|
# # │ i64 ┆ i64 │
|
1880
1765
|
# # ╞══════╪═════╡
|
1881
1766
|
# # │ 1 ┆ 4 │
|
1882
|
-
# # ├╌╌╌╌╌╌┼╌╌╌╌╌┤
|
1883
1767
|
# # │ 2 ┆ 6 │
|
1884
|
-
# # ├╌╌╌╌╌╌┼╌╌╌╌╌┤
|
1885
1768
|
# # │ null ┆ 6 │
|
1886
1769
|
# # └──────┴─────┘
|
1887
1770
|
def backward_fill(limit: nil)
|
@@ -2170,9 +2053,7 @@ module Polars
|
|
2170
2053
|
# # │ u32 │
|
2171
2054
|
# # ╞═════╡
|
2172
2055
|
# # │ 0 │
|
2173
|
-
# # ├╌╌╌╌╌┤
|
2174
2056
|
# # │ 1 │
|
2175
|
-
# # ├╌╌╌╌╌┤
|
2176
2057
|
# # │ 2 │
|
2177
2058
|
# # └─────┘
|
2178
2059
|
#
|
@@ -2186,7 +2067,6 @@ module Polars
|
|
2186
2067
|
# # │ u32 │
|
2187
2068
|
# # ╞═════╡
|
2188
2069
|
# # │ 0 │
|
2189
|
-
# # ├╌╌╌╌╌┤
|
2190
2070
|
# # │ 1 │
|
2191
2071
|
# # └─────┘
|
2192
2072
|
def arg_unique
|
@@ -2211,7 +2091,6 @@ module Polars
|
|
2211
2091
|
# # │ i64 │
|
2212
2092
|
# # ╞═════╡
|
2213
2093
|
# # │ 1 │
|
2214
|
-
# # ├╌╌╌╌╌┤
|
2215
2094
|
# # │ 2 │
|
2216
2095
|
# # └─────┘
|
2217
2096
|
def unique(maintain_order: false)
|
@@ -2290,9 +2169,7 @@ module Polars
|
|
2290
2169
|
# # │ str ┆ i64 ┆ i64 │
|
2291
2170
|
# # ╞════════╪════════╪══════════════╡
|
2292
2171
|
# # │ g1 ┆ 1 ┆ 2 │
|
2293
|
-
# # ├╌╌╌╌╌╌╌╌┼╌╌╌╌╌╌╌╌┼╌╌╌╌╌╌╌╌╌╌╌╌╌╌┤
|
2294
2172
|
# # │ g1 ┆ 2 ┆ 2 │
|
2295
|
-
# # ├╌╌╌╌╌╌╌╌┼╌╌╌╌╌╌╌╌┼╌╌╌╌╌╌╌╌╌╌╌╌╌╌┤
|
2296
2173
|
# # │ g2 ┆ 3 ┆ 3 │
|
2297
2174
|
# # └────────┴────────┴──────────────┘
|
2298
2175
|
#
|
@@ -2314,21 +2191,13 @@ module Polars
|
|
2314
2191
|
# # │ i64 │
|
2315
2192
|
# # ╞════════╡
|
2316
2193
|
# # │ 4 │
|
2317
|
-
# # ├╌╌╌╌╌╌╌╌┤
|
2318
2194
|
# # │ 4 │
|
2319
|
-
# # ├╌╌╌╌╌╌╌╌┤
|
2320
2195
|
# # │ 6 │
|
2321
|
-
# # ├╌╌╌╌╌╌╌╌┤
|
2322
2196
|
# # │ 6 │
|
2323
|
-
# # ├╌╌╌╌╌╌╌╌┤
|
2324
2197
|
# # │ ... │
|
2325
|
-
# # ├╌╌╌╌╌╌╌╌┤
|
2326
2198
|
# # │ 6 │
|
2327
|
-
# # ├╌╌╌╌╌╌╌╌┤
|
2328
2199
|
# # │ 6 │
|
2329
|
-
# # ├╌╌╌╌╌╌╌╌┤
|
2330
2200
|
# # │ 6 │
|
2331
|
-
# # ├╌╌╌╌╌╌╌╌┤
|
2332
2201
|
# # │ 4 │
|
2333
2202
|
# # └────────┘
|
2334
2203
|
def over(expr)
|
@@ -2351,9 +2220,7 @@ module Polars
|
|
2351
2220
|
# # │ bool │
|
2352
2221
|
# # ╞═══════╡
|
2353
2222
|
# # │ false │
|
2354
|
-
# # ├╌╌╌╌╌╌╌┤
|
2355
2223
|
# # │ false │
|
2356
|
-
# # ├╌╌╌╌╌╌╌┤
|
2357
2224
|
# # │ true │
|
2358
2225
|
# # └───────┘
|
2359
2226
|
def is_unique
|
@@ -2379,13 +2246,9 @@ module Polars
|
|
2379
2246
|
# # │ i64 ┆ bool │
|
2380
2247
|
# # ╞═════╪══════════╡
|
2381
2248
|
# # │ 1 ┆ true │
|
2382
|
-
# # ├╌╌╌╌╌┼╌╌╌╌╌╌╌╌╌╌┤
|
2383
2249
|
# # │ 2 ┆ true │
|
2384
|
-
# # ├╌╌╌╌╌┼╌╌╌╌╌╌╌╌╌╌┤
|
2385
2250
|
# # │ 3 ┆ true │
|
2386
|
-
# # ├╌╌╌╌╌┼╌╌╌╌╌╌╌╌╌╌┤
|
2387
2251
|
# # │ 1 ┆ false │
|
2388
|
-
# # ├╌╌╌╌╌┼╌╌╌╌╌╌╌╌╌╌┤
|
2389
2252
|
# # │ 5 ┆ true │
|
2390
2253
|
# # └─────┴──────────┘
|
2391
2254
|
def is_first
|
@@ -2407,9 +2270,7 @@ module Polars
|
|
2407
2270
|
# # │ bool │
|
2408
2271
|
# # ╞═══════╡
|
2409
2272
|
# # │ true │
|
2410
|
-
# # ├╌╌╌╌╌╌╌┤
|
2411
2273
|
# # │ true │
|
2412
|
-
# # ├╌╌╌╌╌╌╌┤
|
2413
2274
|
# # │ false │
|
2414
2275
|
# # └───────┘
|
2415
2276
|
def is_duplicated
|
@@ -2523,7 +2384,6 @@ module Polars
|
|
2523
2384
|
# # │ str ┆ i64 ┆ i64 │
|
2524
2385
|
# # ╞═══════════╪══════╪═════╡
|
2525
2386
|
# # │ g1 ┆ 1 ┆ 2 │
|
2526
|
-
# # ├╌╌╌╌╌╌╌╌╌╌╌┼╌╌╌╌╌╌┼╌╌╌╌╌┤
|
2527
2387
|
# # │ g2 ┆ null ┆ 3 │
|
2528
2388
|
# # └───────────┴──────┴─────┘
|
2529
2389
|
def filter(predicate)
|
@@ -2562,7 +2422,6 @@ module Polars
|
|
2562
2422
|
# # │ str ┆ i64 ┆ i64 │
|
2563
2423
|
# # ╞═══════════╪══════╪═════╡
|
2564
2424
|
# # │ g1 ┆ 1 ┆ 2 │
|
2565
|
-
# # ├╌╌╌╌╌╌╌╌╌╌╌┼╌╌╌╌╌╌┼╌╌╌╌╌┤
|
2566
2425
|
# # │ g2 ┆ null ┆ 3 │
|
2567
2426
|
# # └───────────┴──────┴─────┘
|
2568
2427
|
def where(predicate)
|
@@ -2659,11 +2518,8 @@ module Polars
|
|
2659
2518
|
# # │ i64 ┆ str ┆ i64 │
|
2660
2519
|
# # ╞═════╪═════╪═══════════╡
|
2661
2520
|
# # │ 1 ┆ a ┆ 2 │
|
2662
|
-
# # ├╌╌╌╌╌┼╌╌╌╌╌┼╌╌╌╌╌╌╌╌╌╌╌┤
|
2663
2521
|
# # │ 2 ┆ b ┆ 4 │
|
2664
|
-
# # ├╌╌╌╌╌┼╌╌╌╌╌┼╌╌╌╌╌╌╌╌╌╌╌┤
|
2665
2522
|
# # │ 3 ┆ c ┆ 6 │
|
2666
|
-
# # ├╌╌╌╌╌┼╌╌╌╌╌┼╌╌╌╌╌╌╌╌╌╌╌┤
|
2667
2523
|
# # │ 1 ┆ c ┆ 2 │
|
2668
2524
|
# # └─────┴─────┴───────────┘
|
2669
2525
|
#
|
@@ -2684,9 +2540,7 @@ module Polars
|
|
2684
2540
|
# # │ str ┆ i64 │
|
2685
2541
|
# # ╞═════╪═════╡
|
2686
2542
|
# # │ a ┆ 1 │
|
2687
|
-
# # ├╌╌╌╌╌┼╌╌╌╌╌┤
|
2688
2543
|
# # │ b ┆ 2 │
|
2689
|
-
# # ├╌╌╌╌╌┼╌╌╌╌╌┤
|
2690
2544
|
# # │ c ┆ 4 │
|
2691
2545
|
# # └─────┴─────┘
|
2692
2546
|
# def apply(return_dtype: nil, &f)
|
@@ -2714,21 +2568,13 @@ module Polars
|
|
2714
2568
|
# # │ str │
|
2715
2569
|
# # ╞═════╡
|
2716
2570
|
# # │ h │
|
2717
|
-
# # ├╌╌╌╌╌┤
|
2718
2571
|
# # │ e │
|
2719
|
-
# # ├╌╌╌╌╌┤
|
2720
2572
|
# # │ l │
|
2721
|
-
# # ├╌╌╌╌╌┤
|
2722
2573
|
# # │ l │
|
2723
|
-
# # ├╌╌╌╌╌┤
|
2724
2574
|
# # │ ... │
|
2725
|
-
# # ├╌╌╌╌╌┤
|
2726
2575
|
# # │ o │
|
2727
|
-
# # ├╌╌╌╌╌┤
|
2728
2576
|
# # │ r │
|
2729
|
-
# # ├╌╌╌╌╌┤
|
2730
2577
|
# # │ l │
|
2731
|
-
# # ├╌╌╌╌╌┤
|
2732
2578
|
# # │ d │
|
2733
2579
|
# # └─────┘
|
2734
2580
|
def flatten
|
@@ -2752,15 +2598,10 @@ module Polars
|
|
2752
2598
|
# # │ i64 │
|
2753
2599
|
# # ╞═════╡
|
2754
2600
|
# # │ 1 │
|
2755
|
-
# # ├╌╌╌╌╌┤
|
2756
2601
|
# # │ 2 │
|
2757
|
-
# # ├╌╌╌╌╌┤
|
2758
2602
|
# # │ 3 │
|
2759
|
-
# # ├╌╌╌╌╌┤
|
2760
2603
|
# # │ 4 │
|
2761
|
-
# # ├╌╌╌╌╌┤
|
2762
2604
|
# # │ 5 │
|
2763
|
-
# # ├╌╌╌╌╌┤
|
2764
2605
|
# # │ 6 │
|
2765
2606
|
# # └─────┘
|
2766
2607
|
def explode
|
@@ -2782,9 +2623,7 @@ module Polars
|
|
2782
2623
|
# # │ i64 │
|
2783
2624
|
# # ╞═════╡
|
2784
2625
|
# # │ 1 │
|
2785
|
-
# # ├╌╌╌╌╌┤
|
2786
2626
|
# # │ 4 │
|
2787
|
-
# # ├╌╌╌╌╌┤
|
2788
2627
|
# # │ 7 │
|
2789
2628
|
# # └─────┘
|
2790
2629
|
def take_every(n)
|
@@ -2809,9 +2648,7 @@ module Polars
|
|
2809
2648
|
# # │ i64 │
|
2810
2649
|
# # ╞═════╡
|
2811
2650
|
# # │ 1 │
|
2812
|
-
# # ├╌╌╌╌╌┤
|
2813
2651
|
# # │ 2 │
|
2814
|
-
# # ├╌╌╌╌╌┤
|
2815
2652
|
# # │ 3 │
|
2816
2653
|
# # └─────┘
|
2817
2654
|
def head(n = 10)
|
@@ -2836,9 +2673,7 @@ module Polars
|
|
2836
2673
|
# # │ i64 │
|
2837
2674
|
# # ╞═════╡
|
2838
2675
|
# # │ 5 │
|
2839
|
-
# # ├╌╌╌╌╌┤
|
2840
2676
|
# # │ 6 │
|
2841
|
-
# # ├╌╌╌╌╌┤
|
2842
2677
|
# # │ 7 │
|
2843
2678
|
# # └─────┘
|
2844
2679
|
def tail(n = 10)
|
@@ -2872,11 +2707,8 @@ module Polars
|
|
2872
2707
|
# # │ f64 │
|
2873
2708
|
# # ╞══════╡
|
2874
2709
|
# # │ 1.0 │
|
2875
|
-
# # ├╌╌╌╌╌╌┤
|
2876
2710
|
# # │ 8.0 │
|
2877
|
-
# # ├╌╌╌╌╌╌┤
|
2878
2711
|
# # │ 27.0 │
|
2879
|
-
# # ├╌╌╌╌╌╌┤
|
2880
2712
|
# # │ 64.0 │
|
2881
2713
|
# # └──────┘
|
2882
2714
|
def pow(exponent)
|
@@ -2904,9 +2736,7 @@ module Polars
|
|
2904
2736
|
# # │ bool │
|
2905
2737
|
# # ╞══════════╡
|
2906
2738
|
# # │ true │
|
2907
|
-
# # ├╌╌╌╌╌╌╌╌╌╌┤
|
2908
2739
|
# # │ true │
|
2909
|
-
# # ├╌╌╌╌╌╌╌╌╌╌┤
|
2910
2740
|
# # │ false │
|
2911
2741
|
# # └──────────┘
|
2912
2742
|
def is_in(other)
|
@@ -2949,9 +2779,7 @@ module Polars
|
|
2949
2779
|
# # │ list[str] │
|
2950
2780
|
# # ╞═════════════════╡
|
2951
2781
|
# # │ ["x"] │
|
2952
|
-
# # ├╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌┤
|
2953
2782
|
# # │ ["y", "y"] │
|
2954
|
-
# # ├╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌┤
|
2955
2783
|
# # │ ["z", "z", "z"] │
|
2956
2784
|
# # └─────────────────┘
|
2957
2785
|
def repeat_by(by)
|
@@ -2965,19 +2793,14 @@ module Polars
|
|
2965
2793
|
# Lower bound as primitive type or datetime.
|
2966
2794
|
# @param _end [Object]
|
2967
2795
|
# Upper bound as primitive type or datetime.
|
2968
|
-
# @param
|
2969
|
-
#
|
2970
|
-
# True: Include both start and end.
|
2971
|
-
# (False, False): Exclude start and exclude end.
|
2972
|
-
# (True, True): Include start and include end.
|
2973
|
-
# (False, True): Exclude start and include end.
|
2974
|
-
# (True, False): Include start and exclude end.
|
2796
|
+
# @param closed ["both", "left", "right", "none"]
|
2797
|
+
# Define which sides of the interval are closed (inclusive).
|
2975
2798
|
#
|
2976
2799
|
# @return [Expr]
|
2977
2800
|
#
|
2978
2801
|
# @example
|
2979
2802
|
# df = Polars::DataFrame.new({"num" => [1, 2, 3, 4, 5]})
|
2980
|
-
# df.
|
2803
|
+
# df.with_columns(Polars.col("num").is_between(2, 4).alias("is_between"))
|
2981
2804
|
# # =>
|
2982
2805
|
# # shape: (5, 2)
|
2983
2806
|
# # ┌─────┬────────────┐
|
@@ -2986,26 +2809,65 @@ module Polars
|
|
2986
2809
|
# # │ i64 ┆ bool │
|
2987
2810
|
# # ╞═════╪════════════╡
|
2988
2811
|
# # │ 1 ┆ false │
|
2989
|
-
# #
|
2990
|
-
# # │
|
2991
|
-
# #
|
2812
|
+
# # │ 2 ┆ true │
|
2813
|
+
# # │ 3 ┆ true │
|
2814
|
+
# # │ 4 ┆ true │
|
2815
|
+
# # │ 5 ┆ false │
|
2816
|
+
# # └─────┴────────────┘
|
2817
|
+
#
|
2818
|
+
# @example Use the `closed` argument to include or exclude the values at the bounds:
|
2819
|
+
# df.with_columns(
|
2820
|
+
# Polars.col("num").is_between(2, 4, closed: "left").alias("is_between")
|
2821
|
+
# )
|
2822
|
+
# # =>
|
2823
|
+
# # shape: (5, 2)
|
2824
|
+
# # ┌─────┬────────────┐
|
2825
|
+
# # │ num ┆ is_between │
|
2826
|
+
# # │ --- ┆ --- │
|
2827
|
+
# # │ i64 ┆ bool │
|
2828
|
+
# # ╞═════╪════════════╡
|
2829
|
+
# # │ 1 ┆ false │
|
2830
|
+
# # │ 2 ┆ true │
|
2992
2831
|
# # │ 3 ┆ true │
|
2993
|
-
# # ├╌╌╌╌╌┼╌╌╌╌╌╌╌╌╌╌╌╌┤
|
2994
2832
|
# # │ 4 ┆ false │
|
2995
|
-
# # ├╌╌╌╌╌┼╌╌╌╌╌╌╌╌╌╌╌╌┤
|
2996
2833
|
# # │ 5 ┆ false │
|
2997
2834
|
# # └─────┴────────────┘
|
2998
|
-
|
2999
|
-
|
3000
|
-
|
3001
|
-
|
3002
|
-
|
3003
|
-
|
3004
|
-
|
3005
|
-
|
3006
|
-
|
2835
|
+
#
|
2836
|
+
# @example You can also use strings as well as numeric/temporal values:
|
2837
|
+
# df = Polars::DataFrame.new({"a" => ["a", "b", "c", "d", "e"]})
|
2838
|
+
# df.with_columns(
|
2839
|
+
# Polars.col("a")
|
2840
|
+
# .is_between(Polars.lit("a"), Polars.lit("c"), closed: "both")
|
2841
|
+
# .alias("is_between")
|
2842
|
+
# )
|
2843
|
+
# # =>
|
2844
|
+
# # shape: (5, 2)
|
2845
|
+
# # ┌─────┬────────────┐
|
2846
|
+
# # │ a ┆ is_between │
|
2847
|
+
# # │ --- ┆ --- │
|
2848
|
+
# # │ str ┆ bool │
|
2849
|
+
# # ╞═════╪════════════╡
|
2850
|
+
# # │ a ┆ true │
|
2851
|
+
# # │ b ┆ true │
|
2852
|
+
# # │ c ┆ true │
|
2853
|
+
# # │ d ┆ false │
|
2854
|
+
# # │ e ┆ false │
|
2855
|
+
# # └─────┴────────────┘
|
2856
|
+
def is_between(start, _end, closed: "both")
|
2857
|
+
start = Utils.expr_to_lit_or_expr(start, str_to_lit: false)
|
2858
|
+
_end = Utils.expr_to_lit_or_expr(_end, str_to_lit: false)
|
2859
|
+
|
2860
|
+
case closed
|
2861
|
+
when "none"
|
2862
|
+
(self > start) & (self < _end)
|
2863
|
+
when "both"
|
2864
|
+
(self >= start) & (self <= _end)
|
2865
|
+
when "right"
|
2866
|
+
(self > start) & (self <= _end)
|
2867
|
+
when "left"
|
2868
|
+
(self >= start) & (self < _end)
|
3007
2869
|
else
|
3008
|
-
raise ArgumentError, "
|
2870
|
+
raise ArgumentError, "closed must be one of 'left', 'right', 'both', or 'none'"
|
3009
2871
|
end
|
3010
2872
|
end
|
3011
2873
|
|
@@ -3040,9 +2902,7 @@ module Polars
|
|
3040
2902
|
# # │ u64 ┆ u64 │
|
3041
2903
|
# # ╞══════════════════════╪══════════════════════╡
|
3042
2904
|
# # │ 4629889412789719550 ┆ 6959506404929392568 │
|
3043
|
-
# # ├╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌┼╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌┤
|
3044
2905
|
# # │ 16386608652769605760 ┆ 11638928888656214026 │
|
3045
|
-
# # ├╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌┼╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌┤
|
3046
2906
|
# # │ 11638928888656214026 ┆ 11040941213715918520 │
|
3047
2907
|
# # └──────────────────────┴──────────────────────┘
|
3048
2908
|
def _hash(seed = 0, seed_1 = nil, seed_2 = nil, seed_3 = nil)
|
@@ -3080,9 +2940,7 @@ module Polars
|
|
3080
2940
|
# # │ i64 ┆ u64 │
|
3081
2941
|
# # ╞═══════════════╪══════════╡
|
3082
2942
|
# # │ 1 ┆ 1 │
|
3083
|
-
# # ├╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌┼╌╌╌╌╌╌╌╌╌╌┤
|
3084
2943
|
# # │ 1 ┆ 1 │
|
3085
|
-
# # ├╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌┼╌╌╌╌╌╌╌╌╌╌┤
|
3086
2944
|
# # │ 2 ┆ 2 │
|
3087
2945
|
# # └───────────────┴──────────┘
|
3088
2946
|
def reinterpret(signed: false)
|
@@ -3111,9 +2969,7 @@ module Polars
|
|
3111
2969
|
# # │ i64 │
|
3112
2970
|
# # ╞═════╡
|
3113
2971
|
# # │ 1 │
|
3114
|
-
# # ├╌╌╌╌╌┤
|
3115
2972
|
# # │ 2 │
|
3116
|
-
# # ├╌╌╌╌╌┤
|
3117
2973
|
# # │ 4 │
|
3118
2974
|
# # └─────┘
|
3119
2975
|
# def _inspect(fmt = "%s")
|
@@ -3147,9 +3003,7 @@ module Polars
|
|
3147
3003
|
# # │ i64 ┆ f64 │
|
3148
3004
|
# # ╞═════╪═════╡
|
3149
3005
|
# # │ 1 ┆ 1.0 │
|
3150
|
-
# # ├╌╌╌╌╌┼╌╌╌╌╌┤
|
3151
3006
|
# # │ 2 ┆ NaN │
|
3152
|
-
# # ├╌╌╌╌╌┼╌╌╌╌╌┤
|
3153
3007
|
# # │ 3 ┆ 3.0 │
|
3154
3008
|
# # └─────┴─────┘
|
3155
3009
|
def interpolate(method: "linear")
|
@@ -3221,15 +3075,10 @@ module Polars
|
|
3221
3075
|
# # │ f64 │
|
3222
3076
|
# # ╞══════╡
|
3223
3077
|
# # │ null │
|
3224
|
-
# # ├╌╌╌╌╌╌┤
|
3225
3078
|
# # │ 1.0 │
|
3226
|
-
# # ├╌╌╌╌╌╌┤
|
3227
3079
|
# # │ 2.0 │
|
3228
|
-
# # ├╌╌╌╌╌╌┤
|
3229
3080
|
# # │ 3.0 │
|
3230
|
-
# # ├╌╌╌╌╌╌┤
|
3231
3081
|
# # │ 4.0 │
|
3232
|
-
# # ├╌╌╌╌╌╌┤
|
3233
3082
|
# # │ 5.0 │
|
3234
3083
|
# # └──────┘
|
3235
3084
|
def rolling_min(
|
@@ -3315,15 +3164,10 @@ module Polars
|
|
3315
3164
|
# # │ f64 │
|
3316
3165
|
# # ╞══════╡
|
3317
3166
|
# # │ null │
|
3318
|
-
# # ├╌╌╌╌╌╌┤
|
3319
3167
|
# # │ 2.0 │
|
3320
|
-
# # ├╌╌╌╌╌╌┤
|
3321
3168
|
# # │ 3.0 │
|
3322
|
-
# # ├╌╌╌╌╌╌┤
|
3323
3169
|
# # │ 4.0 │
|
3324
|
-
# # ├╌╌╌╌╌╌┤
|
3325
3170
|
# # │ 5.0 │
|
3326
|
-
# # ├╌╌╌╌╌╌┤
|
3327
3171
|
# # │ 6.0 │
|
3328
3172
|
# # └──────┘
|
3329
3173
|
def rolling_max(
|
@@ -3409,15 +3253,10 @@ module Polars
|
|
3409
3253
|
# # │ f64 │
|
3410
3254
|
# # ╞══════╡
|
3411
3255
|
# # │ null │
|
3412
|
-
# # ├╌╌╌╌╌╌┤
|
3413
3256
|
# # │ 4.5 │
|
3414
|
-
# # ├╌╌╌╌╌╌┤
|
3415
3257
|
# # │ 7.0 │
|
3416
|
-
# # ├╌╌╌╌╌╌┤
|
3417
3258
|
# # │ 4.0 │
|
3418
|
-
# # ├╌╌╌╌╌╌┤
|
3419
3259
|
# # │ 9.0 │
|
3420
|
-
# # ├╌╌╌╌╌╌┤
|
3421
3260
|
# # │ 13.0 │
|
3422
3261
|
# # └──────┘
|
3423
3262
|
def rolling_mean(
|
@@ -3503,15 +3342,10 @@ module Polars
|
|
3503
3342
|
# # │ f64 │
|
3504
3343
|
# # ╞══════╡
|
3505
3344
|
# # │ null │
|
3506
|
-
# # ├╌╌╌╌╌╌┤
|
3507
3345
|
# # │ 3.0 │
|
3508
|
-
# # ├╌╌╌╌╌╌┤
|
3509
3346
|
# # │ 5.0 │
|
3510
|
-
# # ├╌╌╌╌╌╌┤
|
3511
3347
|
# # │ 7.0 │
|
3512
|
-
# # ├╌╌╌╌╌╌┤
|
3513
3348
|
# # │ 9.0 │
|
3514
|
-
# # ├╌╌╌╌╌╌┤
|
3515
3349
|
# # │ 11.0 │
|
3516
3350
|
# # └──────┘
|
3517
3351
|
def rolling_sum(
|
@@ -3597,15 +3431,10 @@ module Polars
|
|
3597
3431
|
# # │ f64 │
|
3598
3432
|
# # ╞══════════╡
|
3599
3433
|
# # │ null │
|
3600
|
-
# # ├╌╌╌╌╌╌╌╌╌╌┤
|
3601
3434
|
# # │ null │
|
3602
|
-
# # ├╌╌╌╌╌╌╌╌╌╌┤
|
3603
3435
|
# # │ 1.0 │
|
3604
|
-
# # ├╌╌╌╌╌╌╌╌╌╌┤
|
3605
3436
|
# # │ 1.0 │
|
3606
|
-
# # ├╌╌╌╌╌╌╌╌╌╌┤
|
3607
3437
|
# # │ 1.527525 │
|
3608
|
-
# # ├╌╌╌╌╌╌╌╌╌╌┤
|
3609
3438
|
# # │ 2.0 │
|
3610
3439
|
# # └──────────┘
|
3611
3440
|
def rolling_std(
|
@@ -3691,15 +3520,10 @@ module Polars
|
|
3691
3520
|
# # │ f64 │
|
3692
3521
|
# # ╞══════════╡
|
3693
3522
|
# # │ null │
|
3694
|
-
# # ├╌╌╌╌╌╌╌╌╌╌┤
|
3695
3523
|
# # │ null │
|
3696
|
-
# # ├╌╌╌╌╌╌╌╌╌╌┤
|
3697
3524
|
# # │ 1.0 │
|
3698
|
-
# # ├╌╌╌╌╌╌╌╌╌╌┤
|
3699
3525
|
# # │ 1.0 │
|
3700
|
-
# # ├╌╌╌╌╌╌╌╌╌╌┤
|
3701
3526
|
# # │ 2.333333 │
|
3702
|
-
# # ├╌╌╌╌╌╌╌╌╌╌┤
|
3703
3527
|
# # │ 4.0 │
|
3704
3528
|
# # └──────────┘
|
3705
3529
|
def rolling_var(
|
@@ -3781,15 +3605,10 @@ module Polars
|
|
3781
3605
|
# # │ f64 │
|
3782
3606
|
# # ╞══════╡
|
3783
3607
|
# # │ null │
|
3784
|
-
# # ├╌╌╌╌╌╌┤
|
3785
3608
|
# # │ null │
|
3786
|
-
# # ├╌╌╌╌╌╌┤
|
3787
3609
|
# # │ 2.0 │
|
3788
|
-
# # ├╌╌╌╌╌╌┤
|
3789
3610
|
# # │ 3.0 │
|
3790
|
-
# # ├╌╌╌╌╌╌┤
|
3791
3611
|
# # │ 4.0 │
|
3792
|
-
# # ├╌╌╌╌╌╌┤
|
3793
3612
|
# # │ 6.0 │
|
3794
3613
|
# # └──────┘
|
3795
3614
|
def rolling_median(
|
@@ -3875,15 +3694,10 @@ module Polars
|
|
3875
3694
|
# # │ f64 │
|
3876
3695
|
# # ╞══════╡
|
3877
3696
|
# # │ null │
|
3878
|
-
# # ├╌╌╌╌╌╌┤
|
3879
3697
|
# # │ null │
|
3880
|
-
# # ├╌╌╌╌╌╌┤
|
3881
3698
|
# # │ 1.0 │
|
3882
|
-
# # ├╌╌╌╌╌╌┤
|
3883
3699
|
# # │ 2.0 │
|
3884
|
-
# # ├╌╌╌╌╌╌┤
|
3885
3700
|
# # │ 3.0 │
|
3886
|
-
# # ├╌╌╌╌╌╌┤
|
3887
3701
|
# # │ 4.0 │
|
3888
3702
|
# # └──────┘
|
3889
3703
|
def rolling_quantile(
|
@@ -3948,13 +3762,9 @@ module Polars
|
|
3948
3762
|
# # │ f64 │
|
3949
3763
|
# # ╞══════════╡
|
3950
3764
|
# # │ null │
|
3951
|
-
# # ├╌╌╌╌╌╌╌╌╌╌┤
|
3952
3765
|
# # │ null │
|
3953
|
-
# # ├╌╌╌╌╌╌╌╌╌╌┤
|
3954
3766
|
# # │ 4.358899 │
|
3955
|
-
# # ├╌╌╌╌╌╌╌╌╌╌┤
|
3956
3767
|
# # │ 4.041452 │
|
3957
|
-
# # ├╌╌╌╌╌╌╌╌╌╌┤
|
3958
3768
|
# # │ 5.567764 │
|
3959
3769
|
# # └──────────┘
|
3960
3770
|
# def rolling_apply(
|
@@ -4005,11 +3815,8 @@ module Polars
|
|
4005
3815
|
# # │ f64 │
|
4006
3816
|
# # ╞═════╡
|
4007
3817
|
# # │ 1.0 │
|
4008
|
-
# # ├╌╌╌╌╌┤
|
4009
3818
|
# # │ 0.0 │
|
4010
|
-
# # ├╌╌╌╌╌┤
|
4011
3819
|
# # │ 1.0 │
|
4012
|
-
# # ├╌╌╌╌╌┤
|
4013
3820
|
# # │ 2.0 │
|
4014
3821
|
# # └─────┘
|
4015
3822
|
def abs
|
@@ -4042,9 +3849,7 @@ module Polars
|
|
4042
3849
|
# # │ u32 │
|
4043
3850
|
# # ╞═════╡
|
4044
3851
|
# # │ 1 │
|
4045
|
-
# # ├╌╌╌╌╌┤
|
4046
3852
|
# # │ 0 │
|
4047
|
-
# # ├╌╌╌╌╌┤
|
4048
3853
|
# # │ 2 │
|
4049
3854
|
# # └─────┘
|
4050
3855
|
def argsort(reverse: false, nulls_last: false)
|
@@ -4087,13 +3892,9 @@ module Polars
|
|
4087
3892
|
# # │ f32 │
|
4088
3893
|
# # ╞═════╡
|
4089
3894
|
# # │ 3.0 │
|
4090
|
-
# # ├╌╌╌╌╌┤
|
4091
3895
|
# # │ 4.5 │
|
4092
|
-
# # ├╌╌╌╌╌┤
|
4093
3896
|
# # │ 1.5 │
|
4094
|
-
# # ├╌╌╌╌╌┤
|
4095
3897
|
# # │ 1.5 │
|
4096
|
-
# # ├╌╌╌╌╌┤
|
4097
3898
|
# # │ 4.5 │
|
4098
3899
|
# # └─────┘
|
4099
3900
|
#
|
@@ -4108,13 +3909,9 @@ module Polars
|
|
4108
3909
|
# # │ u32 │
|
4109
3910
|
# # ╞═════╡
|
4110
3911
|
# # │ 3 │
|
4111
|
-
# # ├╌╌╌╌╌┤
|
4112
3912
|
# # │ 4 │
|
4113
|
-
# # ├╌╌╌╌╌┤
|
4114
3913
|
# # │ 1 │
|
4115
|
-
# # ├╌╌╌╌╌┤
|
4116
3914
|
# # │ 2 │
|
4117
|
-
# # ├╌╌╌╌╌┤
|
4118
3915
|
# # │ 5 │
|
4119
3916
|
# # └─────┘
|
4120
3917
|
def rank(method: "average", reverse: false)
|
@@ -4145,9 +3942,7 @@ module Polars
|
|
4145
3942
|
# # │ i64 │
|
4146
3943
|
# # ╞══════╡
|
4147
3944
|
# # │ null │
|
4148
|
-
# # ├╌╌╌╌╌╌┤
|
4149
3945
|
# # │ -10 │
|
4150
|
-
# # ├╌╌╌╌╌╌┤
|
4151
3946
|
# # │ 20 │
|
4152
3947
|
# # └──────┘
|
4153
3948
|
def diff(n: 1, null_behavior: "ignore")
|
@@ -4181,13 +3976,9 @@ module Polars
|
|
4181
3976
|
# # │ i64 ┆ f64 │
|
4182
3977
|
# # ╞══════╪════════════╡
|
4183
3978
|
# # │ 10 ┆ null │
|
4184
|
-
# # ├╌╌╌╌╌╌┼╌╌╌╌╌╌╌╌╌╌╌╌┤
|
4185
3979
|
# # │ 11 ┆ 0.1 │
|
4186
|
-
# # ├╌╌╌╌╌╌┼╌╌╌╌╌╌╌╌╌╌╌╌┤
|
4187
3980
|
# # │ 12 ┆ 0.090909 │
|
4188
|
-
# # ├╌╌╌╌╌╌┼╌╌╌╌╌╌╌╌╌╌╌╌┤
|
4189
3981
|
# # │ null ┆ 0.0 │
|
4190
|
-
# # ├╌╌╌╌╌╌┼╌╌╌╌╌╌╌╌╌╌╌╌┤
|
4191
3982
|
# # │ 12 ┆ 0.0 │
|
4192
3983
|
# # └──────┴────────────┘
|
4193
3984
|
def pct_change(n: 1)
|
@@ -4280,11 +4071,8 @@ module Polars
|
|
4280
4071
|
# # │ i64 ┆ i64 │
|
4281
4072
|
# # ╞══════╪═════════════╡
|
4282
4073
|
# # │ -50 ┆ 1 │
|
4283
|
-
# # ├╌╌╌╌╌╌┼╌╌╌╌╌╌╌╌╌╌╌╌╌┤
|
4284
4074
|
# # │ 5 ┆ 5 │
|
4285
|
-
# # ├╌╌╌╌╌╌┼╌╌╌╌╌╌╌╌╌╌╌╌╌┤
|
4286
4075
|
# # │ null ┆ null │
|
4287
|
-
# # ├╌╌╌╌╌╌┼╌╌╌╌╌╌╌╌╌╌╌╌╌┤
|
4288
4076
|
# # │ 50 ┆ 10 │
|
4289
4077
|
# # └──────┴─────────────┘
|
4290
4078
|
def clip(min_val, max_val)
|
@@ -4314,11 +4102,8 @@ module Polars
|
|
4314
4102
|
# # │ i64 ┆ i64 │
|
4315
4103
|
# # ╞══════╪═════════════╡
|
4316
4104
|
# # │ -50 ┆ 0 │
|
4317
|
-
# # ├╌╌╌╌╌╌┼╌╌╌╌╌╌╌╌╌╌╌╌╌┤
|
4318
4105
|
# # │ 5 ┆ 5 │
|
4319
|
-
# # ├╌╌╌╌╌╌┼╌╌╌╌╌╌╌╌╌╌╌╌╌┤
|
4320
4106
|
# # │ null ┆ null │
|
4321
|
-
# # ├╌╌╌╌╌╌┼╌╌╌╌╌╌╌╌╌╌╌╌╌┤
|
4322
4107
|
# # │ 50 ┆ 50 │
|
4323
4108
|
# # └──────┴─────────────┘
|
4324
4109
|
def clip_min(min_val)
|
@@ -4348,11 +4133,8 @@ module Polars
|
|
4348
4133
|
# # │ i64 ┆ i64 │
|
4349
4134
|
# # ╞══════╪═════════════╡
|
4350
4135
|
# # │ -50 ┆ -50 │
|
4351
|
-
# # ├╌╌╌╌╌╌┼╌╌╌╌╌╌╌╌╌╌╌╌╌┤
|
4352
4136
|
# # │ 5 ┆ 0 │
|
4353
|
-
# # ├╌╌╌╌╌╌┼╌╌╌╌╌╌╌╌╌╌╌╌╌┤
|
4354
4137
|
# # │ null ┆ null │
|
4355
|
-
# # ├╌╌╌╌╌╌┼╌╌╌╌╌╌╌╌╌╌╌╌╌┤
|
4356
4138
|
# # │ 50 ┆ 0 │
|
4357
4139
|
# # └──────┴─────────────┘
|
4358
4140
|
def clip_max(max_val)
|
@@ -4420,13 +4202,9 @@ module Polars
|
|
4420
4202
|
# # │ i64 │
|
4421
4203
|
# # ╞══════╡
|
4422
4204
|
# # │ -1 │
|
4423
|
-
# # ├╌╌╌╌╌╌┤
|
4424
4205
|
# # │ 0 │
|
4425
|
-
# # ├╌╌╌╌╌╌┤
|
4426
4206
|
# # │ 0 │
|
4427
|
-
# # ├╌╌╌╌╌╌┤
|
4428
4207
|
# # │ 1 │
|
4429
|
-
# # ├╌╌╌╌╌╌┤
|
4430
4208
|
# # │ null │
|
4431
4209
|
# # └──────┘
|
4432
4210
|
def sign
|
@@ -4692,9 +4470,7 @@ module Polars
|
|
4692
4470
|
# # │ list[i64] │
|
4693
4471
|
# # ╞═══════════╡
|
4694
4472
|
# # │ [1, 2, 3] │
|
4695
|
-
# # ├╌╌╌╌╌╌╌╌╌╌╌┤
|
4696
4473
|
# # │ [4, 5, 6] │
|
4697
|
-
# # ├╌╌╌╌╌╌╌╌╌╌╌┤
|
4698
4474
|
# # │ [7, 8, 9] │
|
4699
4475
|
# # └───────────┘
|
4700
4476
|
def reshape(dims)
|
@@ -4720,9 +4496,7 @@ module Polars
|
|
4720
4496
|
# # │ i64 │
|
4721
4497
|
# # ╞═════╡
|
4722
4498
|
# # │ 2 │
|
4723
|
-
# # ├╌╌╌╌╌┤
|
4724
4499
|
# # │ 1 │
|
4725
|
-
# # ├╌╌╌╌╌┤
|
4726
4500
|
# # │ 3 │
|
4727
4501
|
# # └─────┘
|
4728
4502
|
def shuffle(seed: nil)
|
@@ -4759,9 +4533,7 @@ module Polars
|
|
4759
4533
|
# # │ i64 │
|
4760
4534
|
# # ╞═════╡
|
4761
4535
|
# # │ 3 │
|
4762
|
-
# # ├╌╌╌╌╌┤
|
4763
4536
|
# # │ 1 │
|
4764
|
-
# # ├╌╌╌╌╌┤
|
4765
4537
|
# # │ 1 │
|
4766
4538
|
# # └─────┘
|
4767
4539
|
def sample(
|
@@ -4802,9 +4574,7 @@ module Polars
|
|
4802
4574
|
# # │ f64 │
|
4803
4575
|
# # ╞══════════╡
|
4804
4576
|
# # │ 1.0 │
|
4805
|
-
# # ├╌╌╌╌╌╌╌╌╌╌┤
|
4806
4577
|
# # │ 1.666667 │
|
4807
|
-
# # ├╌╌╌╌╌╌╌╌╌╌┤
|
4808
4578
|
# # │ 2.428571 │
|
4809
4579
|
# # └──────────┘
|
4810
4580
|
def ewm_mean(
|
@@ -4813,10 +4583,11 @@ module Polars
|
|
4813
4583
|
half_life: nil,
|
4814
4584
|
alpha: nil,
|
4815
4585
|
adjust: true,
|
4816
|
-
min_periods: 1
|
4586
|
+
min_periods: 1,
|
4587
|
+
ignore_nulls: true
|
4817
4588
|
)
|
4818
4589
|
alpha = _prepare_alpha(com, span, half_life, alpha)
|
4819
|
-
wrap_expr(_rbexpr.ewm_mean(alpha, adjust, min_periods))
|
4590
|
+
wrap_expr(_rbexpr.ewm_mean(alpha, adjust, min_periods, ignore_nulls))
|
4820
4591
|
end
|
4821
4592
|
|
4822
4593
|
# Exponentially-weighted moving standard deviation.
|
@@ -4834,9 +4605,7 @@ module Polars
|
|
4834
4605
|
# # │ f64 │
|
4835
4606
|
# # ╞══════════╡
|
4836
4607
|
# # │ 0.0 │
|
4837
|
-
# # ├╌╌╌╌╌╌╌╌╌╌┤
|
4838
4608
|
# # │ 0.707107 │
|
4839
|
-
# # ├╌╌╌╌╌╌╌╌╌╌┤
|
4840
4609
|
# # │ 0.963624 │
|
4841
4610
|
# # └──────────┘
|
4842
4611
|
def ewm_std(
|
@@ -4846,10 +4615,11 @@ module Polars
|
|
4846
4615
|
alpha: nil,
|
4847
4616
|
adjust: true,
|
4848
4617
|
bias: false,
|
4849
|
-
min_periods: 1
|
4618
|
+
min_periods: 1,
|
4619
|
+
ignore_nulls: true
|
4850
4620
|
)
|
4851
4621
|
alpha = _prepare_alpha(com, span, half_life, alpha)
|
4852
|
-
wrap_expr(_rbexpr.ewm_std(alpha, adjust, bias, min_periods))
|
4622
|
+
wrap_expr(_rbexpr.ewm_std(alpha, adjust, bias, min_periods, ignore_nulls))
|
4853
4623
|
end
|
4854
4624
|
|
4855
4625
|
# Exponentially-weighted moving variance.
|
@@ -4867,9 +4637,7 @@ module Polars
|
|
4867
4637
|
# # │ f64 │
|
4868
4638
|
# # ╞══════════╡
|
4869
4639
|
# # │ 0.0 │
|
4870
|
-
# # ├╌╌╌╌╌╌╌╌╌╌┤
|
4871
4640
|
# # │ 0.5 │
|
4872
|
-
# # ├╌╌╌╌╌╌╌╌╌╌┤
|
4873
4641
|
# # │ 0.928571 │
|
4874
4642
|
# # └──────────┘
|
4875
4643
|
def ewm_var(
|
@@ -4879,10 +4647,11 @@ module Polars
|
|
4879
4647
|
alpha: nil,
|
4880
4648
|
adjust: true,
|
4881
4649
|
bias: false,
|
4882
|
-
min_periods: 1
|
4650
|
+
min_periods: 1,
|
4651
|
+
ignore_nulls: true
|
4883
4652
|
)
|
4884
4653
|
alpha = _prepare_alpha(com, span, half_life, alpha)
|
4885
|
-
wrap_expr(_rbexpr.ewm_var(alpha, adjust, bias, min_periods))
|
4654
|
+
wrap_expr(_rbexpr.ewm_var(alpha, adjust, bias, min_periods, ignore_nulls))
|
4886
4655
|
end
|
4887
4656
|
|
4888
4657
|
# Extend the Series with given number of values.
|
@@ -4906,13 +4675,9 @@ module Polars
|
|
4906
4675
|
# # │ i64 │
|
4907
4676
|
# # ╞════════╡
|
4908
4677
|
# # │ 1 │
|
4909
|
-
# # ├╌╌╌╌╌╌╌╌┤
|
4910
4678
|
# # │ 2 │
|
4911
|
-
# # ├╌╌╌╌╌╌╌╌┤
|
4912
4679
|
# # │ 3 │
|
4913
|
-
# # ├╌╌╌╌╌╌╌╌┤
|
4914
4680
|
# # │ 99 │
|
4915
|
-
# # ├╌╌╌╌╌╌╌╌┤
|
4916
4681
|
# # │ 99 │
|
4917
4682
|
# # └────────┘
|
4918
4683
|
def extend_constant(value, n)
|
@@ -4948,9 +4713,7 @@ module Polars
|
|
4948
4713
|
# # │ struct[2] │
|
4949
4714
|
# # ╞═══════════╡
|
4950
4715
|
# # │ {"c",3} │
|
4951
|
-
# # ├╌╌╌╌╌╌╌╌╌╌╌┤
|
4952
4716
|
# # │ {"b",2} │
|
4953
|
-
# # ├╌╌╌╌╌╌╌╌╌╌╌┤
|
4954
4717
|
# # │ {"a",1} │
|
4955
4718
|
# # └───────────┘
|
4956
4719
|
def value_counts(multithreaded: false, sort: false)
|
@@ -4983,9 +4746,7 @@ module Polars
|
|
4983
4746
|
# # │ u32 │
|
4984
4747
|
# # ╞═════╡
|
4985
4748
|
# # │ 1 │
|
4986
|
-
# # ├╌╌╌╌╌┤
|
4987
4749
|
# # │ 2 │
|
4988
|
-
# # ├╌╌╌╌╌┤
|
4989
4750
|
# # │ 3 │
|
4990
4751
|
# # └─────┘
|
4991
4752
|
def unique_counts
|
@@ -5010,9 +4771,7 @@ module Polars
|
|
5010
4771
|
# # │ f64 │
|
5011
4772
|
# # ╞══════════╡
|
5012
4773
|
# # │ 0.0 │
|
5013
|
-
# # ├╌╌╌╌╌╌╌╌╌╌┤
|
5014
4774
|
# # │ 1.0 │
|
5015
|
-
# # ├╌╌╌╌╌╌╌╌╌╌┤
|
5016
4775
|
# # │ 1.584963 │
|
5017
4776
|
# # └──────────┘
|
5018
4777
|
def log(base = Math::E)
|
@@ -5096,13 +4855,9 @@ module Polars
|
|
5096
4855
|
# # │ f64 │
|
5097
4856
|
# # ╞════════╡
|
5098
4857
|
# # │ 0.0 │
|
5099
|
-
# # ├╌╌╌╌╌╌╌╌┤
|
5100
4858
|
# # │ -3.0 │
|
5101
|
-
# # ├╌╌╌╌╌╌╌╌┤
|
5102
4859
|
# # │ -8.0 │
|
5103
|
-
# # ├╌╌╌╌╌╌╌╌┤
|
5104
4860
|
# # │ -15.0 │
|
5105
|
-
# # ├╌╌╌╌╌╌╌╌┤
|
5106
4861
|
# # │ -24.0 │
|
5107
4862
|
# # └────────┘
|
5108
4863
|
def cumulative_eval(expr, min_periods: 1, parallel: false)
|
@@ -5193,9 +4948,7 @@ module Polars
|
|
5193
4948
|
# # │ i8 ┆ i64 ┆ i32 ┆ i8 ┆ i16 ┆ str ┆ f32 ┆ bool │
|
5194
4949
|
# # ╞═════╪════════════╪════════════╪══════╪══════╪═════╪══════╪═══════╡
|
5195
4950
|
# # │ 1 ┆ 1 ┆ -1 ┆ -112 ┆ -112 ┆ a ┆ 0.1 ┆ true │
|
5196
|
-
# # ├╌╌╌╌╌┼╌╌╌╌╌╌╌╌╌╌╌╌┼╌╌╌╌╌╌╌╌╌╌╌╌┼╌╌╌╌╌╌┼╌╌╌╌╌╌┼╌╌╌╌╌┼╌╌╌╌╌╌┼╌╌╌╌╌╌╌┤
|
5197
4951
|
# # │ 2 ┆ 2 ┆ 2 ┆ 2 ┆ 2 ┆ b ┆ 1.32 ┆ null │
|
5198
|
-
# # ├╌╌╌╌╌┼╌╌╌╌╌╌╌╌╌╌╌╌┼╌╌╌╌╌╌╌╌╌╌╌╌┼╌╌╌╌╌╌┼╌╌╌╌╌╌┼╌╌╌╌╌┼╌╌╌╌╌╌┼╌╌╌╌╌╌╌┤
|
5199
4952
|
# # │ 3 ┆ 8589934592 ┆ 1073741824 ┆ 112 ┆ 129 ┆ c ┆ 0.12 ┆ false │
|
5200
4953
|
# # └─────┴────────────┴────────────┴──────┴──────┴─────┴──────┴───────┘
|
5201
4954
|
def shrink_dtype
|