polars-df 0.2.5-aarch64-linux → 0.3.0-aarch64-linux
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 +1593 -979
- data/lib/polars/3.0/polars.so +0 -0
- data/lib/polars/3.1/polars.so +0 -0
- data/lib/polars/3.2/polars.so +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/data_frame.rb
CHANGED
@@ -367,9 +367,7 @@ module Polars
|
|
367
367
|
# # │ i64 ┆ i64 ┆ str │
|
368
368
|
# # ╞═══════╪════════╪════════╡
|
369
369
|
# # │ 1 ┆ 6 ┆ a │
|
370
|
-
# # ├╌╌╌╌╌╌╌┼╌╌╌╌╌╌╌╌┼╌╌╌╌╌╌╌╌┤
|
371
370
|
# # │ 2 ┆ 7 ┆ b │
|
372
|
-
# # ├╌╌╌╌╌╌╌┼╌╌╌╌╌╌╌╌┼╌╌╌╌╌╌╌╌┤
|
373
371
|
# # │ 3 ┆ 8 ┆ c │
|
374
372
|
# # └───────┴────────┴────────┘
|
375
373
|
def columns=(columns)
|
@@ -529,8 +527,12 @@ module Polars
|
|
529
527
|
columns.include?(name)
|
530
528
|
end
|
531
529
|
|
532
|
-
#
|
533
|
-
#
|
530
|
+
# Returns an enumerator.
|
531
|
+
#
|
532
|
+
# @return [Object]
|
533
|
+
def each(&block)
|
534
|
+
get_columns.each(&block)
|
535
|
+
end
|
534
536
|
|
535
537
|
# Returns subset of the DataFrame.
|
536
538
|
#
|
@@ -637,6 +639,7 @@ module Polars
|
|
637
639
|
# Set item.
|
638
640
|
#
|
639
641
|
# @return [Object]
|
642
|
+
#
|
640
643
|
# def []=(key, value)
|
641
644
|
# if key.is_a?(String)
|
642
645
|
# raise TypeError, "'DataFrame' object does not support 'Series' assignment by index. Use 'DataFrame.with_columns'"
|
@@ -645,6 +648,25 @@ module Polars
|
|
645
648
|
# raise Todo
|
646
649
|
# end
|
647
650
|
|
651
|
+
|
652
|
+
# Return the dataframe as a scalar.
|
653
|
+
#
|
654
|
+
# Equivalent to `df[0,0]`, with a check that the shape is (1,1).
|
655
|
+
#
|
656
|
+
# @return [Object]
|
657
|
+
#
|
658
|
+
# @example
|
659
|
+
# df = Polars::DataFrame.new({"a" => [1, 2, 3], "b" => [4, 5, 6]})
|
660
|
+
# result = df.select((Polars.col("a") * Polars.col("b")).sum)
|
661
|
+
# result.item
|
662
|
+
# # => 32
|
663
|
+
def item
|
664
|
+
if shape != [1, 1]
|
665
|
+
raise ArgumentError, "Can only call .item if the dataframe is of shape (1,1), dataframe is of shape #{shape}"
|
666
|
+
end
|
667
|
+
self[0, 0]
|
668
|
+
end
|
669
|
+
|
648
670
|
# no to_arrow
|
649
671
|
|
650
672
|
# Convert DataFrame to a hash mapping column name to values.
|
@@ -1008,7 +1030,6 @@ module Polars
|
|
1008
1030
|
# # │ str ┆ i64 ┆ i64 ┆ i64 │
|
1009
1031
|
# # ╞════════╪══════════╪══════════╪══════════╡
|
1010
1032
|
# # │ a ┆ 1 ┆ 2 ┆ 3 │
|
1011
|
-
# # ├╌╌╌╌╌╌╌╌┼╌╌╌╌╌╌╌╌╌╌┼╌╌╌╌╌╌╌╌╌╌┼╌╌╌╌╌╌╌╌╌╌┤
|
1012
1033
|
# # │ b ┆ 1 ┆ 2 ┆ 3 │
|
1013
1034
|
# # └────────┴──────────┴──────────┴──────────┘
|
1014
1035
|
#
|
@@ -1022,7 +1043,6 @@ module Polars
|
|
1022
1043
|
# # │ i64 ┆ i64 ┆ i64 │
|
1023
1044
|
# # ╞═════╪═════╪═════╡
|
1024
1045
|
# # │ 1 ┆ 2 ┆ 3 │
|
1025
|
-
# # ├╌╌╌╌╌┼╌╌╌╌╌┼╌╌╌╌╌┤
|
1026
1046
|
# # │ 1 ┆ 2 ┆ 3 │
|
1027
1047
|
# # └─────┴─────┴─────┘
|
1028
1048
|
#
|
@@ -1038,7 +1058,6 @@ module Polars
|
|
1038
1058
|
# # │ str ┆ i64 ┆ i64 ┆ i64 │
|
1039
1059
|
# # ╞═════╪═════╪═════╪═════╡
|
1040
1060
|
# # │ a ┆ 1 ┆ 2 ┆ 3 │
|
1041
|
-
# # ├╌╌╌╌╌┼╌╌╌╌╌┼╌╌╌╌╌┼╌╌╌╌╌┤
|
1042
1061
|
# # │ b ┆ 1 ┆ 2 ┆ 3 │
|
1043
1062
|
# # └─────┴─────┴─────┴─────┘
|
1044
1063
|
def transpose(include_header: false, header_name: "column", column_names: nil)
|
@@ -1080,9 +1099,7 @@ module Polars
|
|
1080
1099
|
# # │ str ┆ i64 │
|
1081
1100
|
# # ╞═════╪═════╡
|
1082
1101
|
# # │ c ┆ 3 │
|
1083
|
-
# # ├╌╌╌╌╌┼╌╌╌╌╌┤
|
1084
1102
|
# # │ b ┆ 2 │
|
1085
|
-
# # ├╌╌╌╌╌┼╌╌╌╌╌┤
|
1086
1103
|
# # │ a ┆ 1 │
|
1087
1104
|
# # └─────┴─────┘
|
1088
1105
|
def reverse
|
@@ -1113,9 +1130,7 @@ module Polars
|
|
1113
1130
|
# # │ i64 ┆ i64 ┆ str │
|
1114
1131
|
# # ╞═══════╪═════╪═════╡
|
1115
1132
|
# # │ 1 ┆ 6 ┆ a │
|
1116
|
-
# # ├╌╌╌╌╌╌╌┼╌╌╌╌╌┼╌╌╌╌╌┤
|
1117
1133
|
# # │ 2 ┆ 7 ┆ b │
|
1118
|
-
# # ├╌╌╌╌╌╌╌┼╌╌╌╌╌┼╌╌╌╌╌┤
|
1119
1134
|
# # │ 3 ┆ 8 ┆ c │
|
1120
1135
|
# # └───────┴─────┴─────┘
|
1121
1136
|
def rename(mapping)
|
@@ -1143,9 +1158,7 @@ module Polars
|
|
1143
1158
|
# # │ i64 ┆ i64 ┆ i64 │
|
1144
1159
|
# # ╞═════╪═════╪═════╡
|
1145
1160
|
# # │ 1 ┆ 97 ┆ 4 │
|
1146
|
-
# # ├╌╌╌╌╌┼╌╌╌╌╌┼╌╌╌╌╌┤
|
1147
1161
|
# # │ 2 ┆ 98 ┆ 5 │
|
1148
|
-
# # ├╌╌╌╌╌┼╌╌╌╌╌┼╌╌╌╌╌┤
|
1149
1162
|
# # │ 3 ┆ 99 ┆ 6 │
|
1150
1163
|
# # └─────┴─────┴─────┘
|
1151
1164
|
#
|
@@ -1167,11 +1180,8 @@ module Polars
|
|
1167
1180
|
# # │ i64 ┆ f64 ┆ bool ┆ f64 │
|
1168
1181
|
# # ╞═════╪══════╪═══════╪══════╡
|
1169
1182
|
# # │ 1 ┆ 0.5 ┆ true ┆ -2.5 │
|
1170
|
-
# # ├╌╌╌╌╌┼╌╌╌╌╌╌┼╌╌╌╌╌╌╌┼╌╌╌╌╌╌┤
|
1171
1183
|
# # │ 2 ┆ 4.0 ┆ true ┆ 15.0 │
|
1172
|
-
# # ├╌╌╌╌╌┼╌╌╌╌╌╌┼╌╌╌╌╌╌╌┼╌╌╌╌╌╌┤
|
1173
1184
|
# # │ 3 ┆ 10.0 ┆ false ┆ 20.5 │
|
1174
|
-
# # ├╌╌╌╌╌┼╌╌╌╌╌╌┼╌╌╌╌╌╌╌┼╌╌╌╌╌╌┤
|
1175
1185
|
# # │ 4 ┆ 13.0 ┆ true ┆ 0.0 │
|
1176
1186
|
# # └─────┴──────┴───────┴──────┘
|
1177
1187
|
def insert_at_idx(index, series)
|
@@ -1206,7 +1216,6 @@ module Polars
|
|
1206
1216
|
# # │ i64 ┆ i64 ┆ str │
|
1207
1217
|
# # ╞═════╪═════╪═════╡
|
1208
1218
|
# # │ 1 ┆ 6 ┆ a │
|
1209
|
-
# # ├╌╌╌╌╌┼╌╌╌╌╌┼╌╌╌╌╌┤
|
1210
1219
|
# # │ 2 ┆ 7 ┆ b │
|
1211
1220
|
# # └─────┴─────┴─────┘
|
1212
1221
|
#
|
@@ -1248,17 +1257,11 @@ module Polars
|
|
1248
1257
|
# # │ str ┆ f64 ┆ f64 ┆ f64 ┆ str ┆ str │
|
1249
1258
|
# # ╞════════════╪══════════╪══════════╪══════════╪══════╪══════╡
|
1250
1259
|
# # │ count ┆ 3.0 ┆ 3.0 ┆ 3.0 ┆ 3 ┆ 3 │
|
1251
|
-
# # ├╌╌╌╌╌╌╌╌╌╌╌╌┼╌╌╌╌╌╌╌╌╌╌┼╌╌╌╌╌╌╌╌╌╌┼╌╌╌╌╌╌╌╌╌╌┼╌╌╌╌╌╌┼╌╌╌╌╌╌┤
|
1252
1260
|
# # │ null_count ┆ 0.0 ┆ 1.0 ┆ 0.0 ┆ 1 ┆ 1 │
|
1253
|
-
# # ├╌╌╌╌╌╌╌╌╌╌╌╌┼╌╌╌╌╌╌╌╌╌╌┼╌╌╌╌╌╌╌╌╌╌┼╌╌╌╌╌╌╌╌╌╌┼╌╌╌╌╌╌┼╌╌╌╌╌╌┤
|
1254
1261
|
# # │ mean ┆ 2.266667 ┆ 4.5 ┆ 0.666667 ┆ null ┆ null │
|
1255
|
-
# # ├╌╌╌╌╌╌╌╌╌╌╌╌┼╌╌╌╌╌╌╌╌╌╌┼╌╌╌╌╌╌╌╌╌╌┼╌╌╌╌╌╌╌╌╌╌┼╌╌╌╌╌╌┼╌╌╌╌╌╌┤
|
1256
1262
|
# # │ std ┆ 1.101514 ┆ 0.707107 ┆ 0.57735 ┆ null ┆ null │
|
1257
|
-
# # ├╌╌╌╌╌╌╌╌╌╌╌╌┼╌╌╌╌╌╌╌╌╌╌┼╌╌╌╌╌╌╌╌╌╌┼╌╌╌╌╌╌╌╌╌╌┼╌╌╌╌╌╌┼╌╌╌╌╌╌┤
|
1258
1263
|
# # │ min ┆ 1.0 ┆ 4.0 ┆ 0.0 ┆ b ┆ eur │
|
1259
|
-
# # ├╌╌╌╌╌╌╌╌╌╌╌╌┼╌╌╌╌╌╌╌╌╌╌┼╌╌╌╌╌╌╌╌╌╌┼╌╌╌╌╌╌╌╌╌╌┼╌╌╌╌╌╌┼╌╌╌╌╌╌┤
|
1260
1264
|
# # │ max ┆ 3.0 ┆ 5.0 ┆ 1.0 ┆ c ┆ usd │
|
1261
|
-
# # ├╌╌╌╌╌╌╌╌╌╌╌╌┼╌╌╌╌╌╌╌╌╌╌┼╌╌╌╌╌╌╌╌╌╌┼╌╌╌╌╌╌╌╌╌╌┼╌╌╌╌╌╌┼╌╌╌╌╌╌┤
|
1262
1265
|
# # │ median ┆ 2.8 ┆ 4.5 ┆ 1.0 ┆ null ┆ null │
|
1263
1266
|
# # └────────────┴──────────┴──────────┴──────────┴──────┴──────┘
|
1264
1267
|
def describe
|
@@ -1345,9 +1348,7 @@ module Polars
|
|
1345
1348
|
# # │ i64 ┆ i64 ┆ str │
|
1346
1349
|
# # ╞═══════╪═════╪═════╡
|
1347
1350
|
# # │ 10 ┆ 6 ┆ a │
|
1348
|
-
# # ├╌╌╌╌╌╌╌┼╌╌╌╌╌┼╌╌╌╌╌┤
|
1349
1351
|
# # │ 20 ┆ 7 ┆ b │
|
1350
|
-
# # ├╌╌╌╌╌╌╌┼╌╌╌╌╌┼╌╌╌╌╌┤
|
1351
1352
|
# # │ 30 ┆ 8 ┆ c │
|
1352
1353
|
# # └───────┴─────┴─────┘
|
1353
1354
|
def replace_at_idx(index, series)
|
@@ -1386,9 +1387,7 @@ module Polars
|
|
1386
1387
|
# # │ i64 ┆ f64 ┆ str │
|
1387
1388
|
# # ╞═════╪═════╪═════╡
|
1388
1389
|
# # │ 3 ┆ 8.0 ┆ c │
|
1389
|
-
# # ├╌╌╌╌╌┼╌╌╌╌╌┼╌╌╌╌╌┤
|
1390
1390
|
# # │ 2 ┆ 7.0 ┆ b │
|
1391
|
-
# # ├╌╌╌╌╌┼╌╌╌╌╌┼╌╌╌╌╌┤
|
1392
1391
|
# # │ 1 ┆ 6.0 ┆ a │
|
1393
1392
|
# # └─────┴─────┴─────┘
|
1394
1393
|
#
|
@@ -1405,9 +1404,7 @@ module Polars
|
|
1405
1404
|
# # │ i64 ┆ f64 ┆ str │
|
1406
1405
|
# # ╞═════╪═════╪═════╡
|
1407
1406
|
# # │ 3 ┆ 8.0 ┆ c │
|
1408
|
-
# # ├╌╌╌╌╌┼╌╌╌╌╌┼╌╌╌╌╌┤
|
1409
1407
|
# # │ 2 ┆ 7.0 ┆ b │
|
1410
|
-
# # ├╌╌╌╌╌┼╌╌╌╌╌┼╌╌╌╌╌┤
|
1411
1408
|
# # │ 1 ┆ 6.0 ┆ a │
|
1412
1409
|
# # └─────┴─────┴─────┘
|
1413
1410
|
def sort(by, reverse: false, nulls_last: false)
|
@@ -1473,9 +1470,7 @@ module Polars
|
|
1473
1470
|
# # │ i64 ┆ i64 │
|
1474
1471
|
# # ╞═════╪═════╡
|
1475
1472
|
# # │ 10 ┆ 4 │
|
1476
|
-
# # ├╌╌╌╌╌┼╌╌╌╌╌┤
|
1477
1473
|
# # │ 20 ┆ 5 │
|
1478
|
-
# # ├╌╌╌╌╌┼╌╌╌╌╌┤
|
1479
1474
|
# # │ 30 ┆ 6 │
|
1480
1475
|
# # └─────┴─────┘
|
1481
1476
|
def replace(column, new_col)
|
@@ -1510,7 +1505,6 @@ module Polars
|
|
1510
1505
|
# # │ i64 ┆ f64 ┆ str │
|
1511
1506
|
# # ╞═════╪═════╪═════╡
|
1512
1507
|
# # │ 2 ┆ 7.0 ┆ b │
|
1513
|
-
# # ├╌╌╌╌╌┼╌╌╌╌╌┼╌╌╌╌╌┤
|
1514
1508
|
# # │ 3 ┆ 8.0 ┆ c │
|
1515
1509
|
# # └─────┴─────┴─────┘
|
1516
1510
|
def slice(offset, length = nil)
|
@@ -1542,11 +1536,8 @@ module Polars
|
|
1542
1536
|
# # │ i64 ┆ str │
|
1543
1537
|
# # ╞═════╪═════╡
|
1544
1538
|
# # │ 1 ┆ a │
|
1545
|
-
# # ├╌╌╌╌╌┼╌╌╌╌╌┤
|
1546
1539
|
# # │ 2 ┆ b │
|
1547
|
-
# # ├╌╌╌╌╌┼╌╌╌╌╌┤
|
1548
1540
|
# # │ 3 ┆ c │
|
1549
|
-
# # ├╌╌╌╌╌┼╌╌╌╌╌┤
|
1550
1541
|
# # │ 4 ┆ d │
|
1551
1542
|
# # └─────┴─────┘
|
1552
1543
|
def limit(n = 5)
|
@@ -1577,9 +1568,7 @@ module Polars
|
|
1577
1568
|
# # │ i64 ┆ i64 ┆ str │
|
1578
1569
|
# # ╞═════╪═════╪═════╡
|
1579
1570
|
# # │ 1 ┆ 6 ┆ a │
|
1580
|
-
# # ├╌╌╌╌╌┼╌╌╌╌╌┼╌╌╌╌╌┤
|
1581
1571
|
# # │ 2 ┆ 7 ┆ b │
|
1582
|
-
# # ├╌╌╌╌╌┼╌╌╌╌╌┼╌╌╌╌╌┤
|
1583
1572
|
# # │ 3 ┆ 8 ┆ c │
|
1584
1573
|
# # └─────┴─────┴─────┘
|
1585
1574
|
def head(n = 5)
|
@@ -1610,9 +1599,7 @@ module Polars
|
|
1610
1599
|
# # │ i64 ┆ i64 ┆ str │
|
1611
1600
|
# # ╞═════╪═════╪═════╡
|
1612
1601
|
# # │ 3 ┆ 8 ┆ c │
|
1613
|
-
# # ├╌╌╌╌╌┼╌╌╌╌╌┼╌╌╌╌╌┤
|
1614
1602
|
# # │ 4 ┆ 9 ┆ d │
|
1615
|
-
# # ├╌╌╌╌╌┼╌╌╌╌╌┼╌╌╌╌╌┤
|
1616
1603
|
# # │ 5 ┆ 10 ┆ e │
|
1617
1604
|
# # └─────┴─────┴─────┘
|
1618
1605
|
def tail(n = 5)
|
@@ -1643,7 +1630,6 @@ module Polars
|
|
1643
1630
|
# # │ i64 ┆ i64 ┆ str │
|
1644
1631
|
# # ╞═════╪═════╪═════╡
|
1645
1632
|
# # │ 1 ┆ 6 ┆ a │
|
1646
|
-
# # ├╌╌╌╌╌┼╌╌╌╌╌┼╌╌╌╌╌┤
|
1647
1633
|
# # │ 3 ┆ 8 ┆ c │
|
1648
1634
|
# # └─────┴─────┴─────┘
|
1649
1635
|
def drop_nulls(subset: nil)
|
@@ -1685,11 +1671,8 @@ module Polars
|
|
1685
1671
|
# # │ i64 ┆ i64 │
|
1686
1672
|
# # ╞═════╪═════╡
|
1687
1673
|
# # │ 1 ┆ 10 │
|
1688
|
-
# # ├╌╌╌╌╌┼╌╌╌╌╌┤
|
1689
1674
|
# # │ 2 ┆ 20 │
|
1690
|
-
# # ├╌╌╌╌╌┼╌╌╌╌╌┤
|
1691
1675
|
# # │ 3 ┆ 30 │
|
1692
|
-
# # ├╌╌╌╌╌┼╌╌╌╌╌┤
|
1693
1676
|
# # │ 4 ┆ 40 │
|
1694
1677
|
# # └─────┴─────┘
|
1695
1678
|
def pipe(func, *args, **kwargs, &block)
|
@@ -1721,9 +1704,7 @@ module Polars
|
|
1721
1704
|
# # │ u32 ┆ i64 ┆ i64 │
|
1722
1705
|
# # ╞════════╪═════╪═════╡
|
1723
1706
|
# # │ 0 ┆ 1 ┆ 2 │
|
1724
|
-
# # ├╌╌╌╌╌╌╌╌┼╌╌╌╌╌┼╌╌╌╌╌┤
|
1725
1707
|
# # │ 1 ┆ 3 ┆ 4 │
|
1726
|
-
# # ├╌╌╌╌╌╌╌╌┼╌╌╌╌╌┼╌╌╌╌╌┤
|
1727
1708
|
# # │ 2 ┆ 5 ┆ 6 │
|
1728
1709
|
# # └────────┴─────┴─────┘
|
1729
1710
|
def with_row_count(name: "row_nr", offset: 0)
|
@@ -1758,18 +1739,13 @@ module Polars
|
|
1758
1739
|
# # │ str ┆ i64 │
|
1759
1740
|
# # ╞═════╪═════╡
|
1760
1741
|
# # │ a ┆ 4 │
|
1761
|
-
# # ├╌╌╌╌╌┼╌╌╌╌╌┤
|
1762
1742
|
# # │ b ┆ 11 │
|
1763
|
-
# # ├╌╌╌╌╌┼╌╌╌╌╌┤
|
1764
1743
|
# # │ c ┆ 6 │
|
1765
1744
|
# # └─────┴─────┘
|
1766
1745
|
def groupby(by, maintain_order: false)
|
1767
1746
|
if !Utils.bool?(maintain_order)
|
1768
1747
|
raise TypeError, "invalid input for groupby arg `maintain_order`: #{maintain_order}."
|
1769
1748
|
end
|
1770
|
-
if by.is_a?(String)
|
1771
|
-
by = [by]
|
1772
|
-
end
|
1773
1749
|
GroupBy.new(
|
1774
1750
|
_df,
|
1775
1751
|
by,
|
@@ -1856,15 +1832,10 @@ module Polars
|
|
1856
1832
|
# # │ datetime[μs] ┆ i64 ┆ i64 ┆ i64 │
|
1857
1833
|
# # ╞═════════════════════╪═══════╪═══════╪═══════╡
|
1858
1834
|
# # │ 2020-01-01 13:45:48 ┆ 3 ┆ 3 ┆ 3 │
|
1859
|
-
# # ├╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌┼╌╌╌╌╌╌╌┼╌╌╌╌╌╌╌┼╌╌╌╌╌╌╌┤
|
1860
1835
|
# # │ 2020-01-01 16:42:13 ┆ 10 ┆ 3 ┆ 7 │
|
1861
|
-
# # ├╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌┼╌╌╌╌╌╌╌┼╌╌╌╌╌╌╌┼╌╌╌╌╌╌╌┤
|
1862
1836
|
# # │ 2020-01-01 16:45:09 ┆ 15 ┆ 3 ┆ 7 │
|
1863
|
-
# # ├╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌┼╌╌╌╌╌╌╌┼╌╌╌╌╌╌╌┼╌╌╌╌╌╌╌┤
|
1864
1837
|
# # │ 2020-01-02 18:12:48 ┆ 24 ┆ 3 ┆ 9 │
|
1865
|
-
# # ├╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌┼╌╌╌╌╌╌╌┼╌╌╌╌╌╌╌┼╌╌╌╌╌╌╌┤
|
1866
1838
|
# # │ 2020-01-03 19:45:32 ┆ 11 ┆ 2 ┆ 9 │
|
1867
|
-
# # ├╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌┼╌╌╌╌╌╌╌┼╌╌╌╌╌╌╌┼╌╌╌╌╌╌╌┤
|
1868
1839
|
# # │ 2020-01-08 23:16:43 ┆ 1 ┆ 1 ┆ 1 │
|
1869
1840
|
# # └─────────────────────┴───────┴───────┴───────┘
|
1870
1841
|
def groupby_rolling(
|
@@ -1961,17 +1932,11 @@ module Polars
|
|
1961
1932
|
# # │ datetime[μs] ┆ i64 │
|
1962
1933
|
# # ╞═════════════════════╪═════╡
|
1963
1934
|
# # │ 2021-12-16 00:00:00 ┆ 0 │
|
1964
|
-
# # ├╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌┼╌╌╌╌╌┤
|
1965
1935
|
# # │ 2021-12-16 00:30:00 ┆ 1 │
|
1966
|
-
# # ├╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌┼╌╌╌╌╌┤
|
1967
1936
|
# # │ 2021-12-16 01:00:00 ┆ 2 │
|
1968
|
-
# # ├╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌┼╌╌╌╌╌┤
|
1969
1937
|
# # │ 2021-12-16 01:30:00 ┆ 3 │
|
1970
|
-
# # ├╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌┼╌╌╌╌╌┤
|
1971
1938
|
# # │ 2021-12-16 02:00:00 ┆ 4 │
|
1972
|
-
# # ├╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌┼╌╌╌╌╌┤
|
1973
1939
|
# # │ 2021-12-16 02:30:00 ┆ 5 │
|
1974
|
-
# # ├╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌┼╌╌╌╌╌┤
|
1975
1940
|
# # │ 2021-12-16 03:00:00 ┆ 6 │
|
1976
1941
|
# # └─────────────────────┴─────┘
|
1977
1942
|
#
|
@@ -1990,11 +1955,8 @@ module Polars
|
|
1990
1955
|
# # │ datetime[μs] ┆ datetime[μs] ┆ datetime[μs] │
|
1991
1956
|
# # ╞═════════════════════╪═════════════════════╪═════════════════════╡
|
1992
1957
|
# # │ 2021-12-15 23:00:00 ┆ 2021-12-16 00:00:00 ┆ 2021-12-16 00:00:00 │
|
1993
|
-
# # ├╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌┼╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌┼╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌┤
|
1994
1958
|
# # │ 2021-12-16 00:00:00 ┆ 2021-12-16 00:30:00 ┆ 2021-12-16 01:00:00 │
|
1995
|
-
# # ├╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌┼╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌┼╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌┤
|
1996
1959
|
# # │ 2021-12-16 01:00:00 ┆ 2021-12-16 01:30:00 ┆ 2021-12-16 02:00:00 │
|
1997
|
-
# # ├╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌┼╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌┼╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌┤
|
1998
1960
|
# # │ 2021-12-16 02:00:00 ┆ 2021-12-16 02:30:00 ┆ 2021-12-16 03:00:00 │
|
1999
1961
|
# # └─────────────────────┴─────────────────────┴─────────────────────┘
|
2000
1962
|
#
|
@@ -2010,11 +1972,8 @@ module Polars
|
|
2010
1972
|
# # │ datetime[μs] ┆ datetime[μs] ┆ datetime[μs] ┆ u32 │
|
2011
1973
|
# # ╞═════════════════════╪═════════════════════╪═════════════════════╪════════════╡
|
2012
1974
|
# # │ 2021-12-15 23:00:00 ┆ 2021-12-16 00:00:00 ┆ 2021-12-15 23:00:00 ┆ 1 │
|
2013
|
-
# # ├╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌┼╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌┼╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌┼╌╌╌╌╌╌╌╌╌╌╌╌┤
|
2014
1975
|
# # │ 2021-12-16 00:00:00 ┆ 2021-12-16 01:00:00 ┆ 2021-12-16 00:00:00 ┆ 2 │
|
2015
|
-
# # ├╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌┼╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌┼╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌┼╌╌╌╌╌╌╌╌╌╌╌╌┤
|
2016
1976
|
# # │ 2021-12-16 01:00:00 ┆ 2021-12-16 02:00:00 ┆ 2021-12-16 01:00:00 ┆ 2 │
|
2017
|
-
# # ├╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌┼╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌┼╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌┼╌╌╌╌╌╌╌╌╌╌╌╌┤
|
2018
1977
|
# # │ 2021-12-16 02:00:00 ┆ 2021-12-16 03:00:00 ┆ 2021-12-16 02:00:00 ┆ 2 │
|
2019
1978
|
# # └─────────────────────┴─────────────────────┴─────────────────────┴────────────┘
|
2020
1979
|
#
|
@@ -2033,11 +1992,8 @@ module Polars
|
|
2033
1992
|
# # │ datetime[μs] ┆ u32 ┆ list[datetime[μs]] │
|
2034
1993
|
# # ╞═════════════════════╪════════════╪═════════════════════════════════════╡
|
2035
1994
|
# # │ 2021-12-16 00:00:00 ┆ 2 ┆ [2021-12-16 00:00:00, 2021-12-16... │
|
2036
|
-
# # ├╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌┼╌╌╌╌╌╌╌╌╌╌╌╌┼╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌┤
|
2037
1995
|
# # │ 2021-12-16 01:00:00 ┆ 2 ┆ [2021-12-16 01:00:00, 2021-12-16... │
|
2038
|
-
# # ├╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌┼╌╌╌╌╌╌╌╌╌╌╌╌┼╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌┤
|
2039
1996
|
# # │ 2021-12-16 02:00:00 ┆ 2 ┆ [2021-12-16 02:00:00, 2021-12-16... │
|
2040
|
-
# # ├╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌┼╌╌╌╌╌╌╌╌╌╌╌╌┼╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌┤
|
2041
1997
|
# # │ 2021-12-16 03:00:00 ┆ 1 ┆ [2021-12-16 03:00:00] │
|
2042
1998
|
# # └─────────────────────┴────────────┴─────────────────────────────────────┘
|
2043
1999
|
#
|
@@ -2053,13 +2009,9 @@ module Polars
|
|
2053
2009
|
# # │ datetime[μs] ┆ u32 │
|
2054
2010
|
# # ╞═════════════════════╪════════════╡
|
2055
2011
|
# # │ 2021-12-15 23:00:00 ┆ 1 │
|
2056
|
-
# # ├╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌┼╌╌╌╌╌╌╌╌╌╌╌╌┤
|
2057
2012
|
# # │ 2021-12-16 00:00:00 ┆ 3 │
|
2058
|
-
# # ├╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌┼╌╌╌╌╌╌╌╌╌╌╌╌┤
|
2059
2013
|
# # │ 2021-12-16 01:00:00 ┆ 3 │
|
2060
|
-
# # ├╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌┼╌╌╌╌╌╌╌╌╌╌╌╌┤
|
2061
2014
|
# # │ 2021-12-16 02:00:00 ┆ 3 │
|
2062
|
-
# # ├╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌┼╌╌╌╌╌╌╌╌╌╌╌╌┤
|
2063
2015
|
# # │ 2021-12-16 03:00:00 ┆ 1 │
|
2064
2016
|
# # └─────────────────────┴────────────┘
|
2065
2017
|
#
|
@@ -2089,17 +2041,11 @@ module Polars
|
|
2089
2041
|
# # │ str ┆ datetime[μs] ┆ datetime[μs] ┆ datetime[μs] ┆ u32 │
|
2090
2042
|
# # ╞════════╪═════════════════════╪═════════════════════╪═════════════════════╪════════════╡
|
2091
2043
|
# # │ a ┆ 2021-12-15 23:00:00 ┆ 2021-12-16 00:00:00 ┆ 2021-12-15 23:00:00 ┆ 1 │
|
2092
|
-
# # ├╌╌╌╌╌╌╌╌┼╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌┼╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌┼╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌┼╌╌╌╌╌╌╌╌╌╌╌╌┤
|
2093
2044
|
# # │ a ┆ 2021-12-16 00:00:00 ┆ 2021-12-16 01:00:00 ┆ 2021-12-16 00:00:00 ┆ 3 │
|
2094
|
-
# # ├╌╌╌╌╌╌╌╌┼╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌┼╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌┼╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌┼╌╌╌╌╌╌╌╌╌╌╌╌┤
|
2095
2045
|
# # │ a ┆ 2021-12-16 01:00:00 ┆ 2021-12-16 02:00:00 ┆ 2021-12-16 01:00:00 ┆ 1 │
|
2096
|
-
# # ├╌╌╌╌╌╌╌╌┼╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌┼╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌┼╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌┼╌╌╌╌╌╌╌╌╌╌╌╌┤
|
2097
2046
|
# # │ a ┆ 2021-12-16 02:00:00 ┆ 2021-12-16 03:00:00 ┆ 2021-12-16 02:00:00 ┆ 2 │
|
2098
|
-
# # ├╌╌╌╌╌╌╌╌┼╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌┼╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌┼╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌┼╌╌╌╌╌╌╌╌╌╌╌╌┤
|
2099
2047
|
# # │ a ┆ 2021-12-16 03:00:00 ┆ 2021-12-16 04:00:00 ┆ 2021-12-16 03:00:00 ┆ 1 │
|
2100
|
-
# # ├╌╌╌╌╌╌╌╌┼╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌┼╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌┼╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌┼╌╌╌╌╌╌╌╌╌╌╌╌┤
|
2101
2048
|
# # │ b ┆ 2021-12-16 01:00:00 ┆ 2021-12-16 02:00:00 ┆ 2021-12-16 01:00:00 ┆ 2 │
|
2102
|
-
# # ├╌╌╌╌╌╌╌╌┼╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌┼╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌┼╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌┼╌╌╌╌╌╌╌╌╌╌╌╌┤
|
2103
2049
|
# # │ b ┆ 2021-12-16 02:00:00 ┆ 2021-12-16 03:00:00 ┆ 2021-12-16 02:00:00 ┆ 1 │
|
2104
2050
|
# # └────────┴─────────────────────┴─────────────────────┴─────────────────────┴────────────┘
|
2105
2051
|
#
|
@@ -2125,9 +2071,7 @@ module Polars
|
|
2125
2071
|
# # │ i64 ┆ i64 ┆ i64 ┆ list[str] │
|
2126
2072
|
# # ╞═════════════════╪═════════════════╪═════╪═════════════════╡
|
2127
2073
|
# # │ 0 ┆ 3 ┆ 0 ┆ ["A", "B", "B"] │
|
2128
|
-
# # ├╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌┼╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌┼╌╌╌╌╌┼╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌┤
|
2129
2074
|
# # │ 2 ┆ 5 ┆ 2 ┆ ["B", "B", "C"] │
|
2130
|
-
# # ├╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌┼╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌┼╌╌╌╌╌┼╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌┤
|
2131
2075
|
# # │ 4 ┆ 7 ┆ 4 ┆ ["C"] │
|
2132
2076
|
# # └─────────────────┴─────────────────┴─────┴─────────────────┘
|
2133
2077
|
def groupby_dynamic(
|
@@ -2213,17 +2157,11 @@ module Polars
|
|
2213
2157
|
# # │ datetime[ns] ┆ str ┆ i64 │
|
2214
2158
|
# # ╞═════════════════════╪════════╪════════╡
|
2215
2159
|
# # │ 2021-02-01 00:00:00 ┆ A ┆ 0 │
|
2216
|
-
# # ├╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌┼╌╌╌╌╌╌╌╌┼╌╌╌╌╌╌╌╌┤
|
2217
2160
|
# # │ 2021-03-01 00:00:00 ┆ A ┆ 0 │
|
2218
|
-
# # ├╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌┼╌╌╌╌╌╌╌╌┼╌╌╌╌╌╌╌╌┤
|
2219
2161
|
# # │ 2021-04-01 00:00:00 ┆ A ┆ 0 │
|
2220
|
-
# # ├╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌┼╌╌╌╌╌╌╌╌┼╌╌╌╌╌╌╌╌┤
|
2221
2162
|
# # │ 2021-05-01 00:00:00 ┆ A ┆ 2 │
|
2222
|
-
# # ├╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌┼╌╌╌╌╌╌╌╌┼╌╌╌╌╌╌╌╌┤
|
2223
2163
|
# # │ 2021-04-01 00:00:00 ┆ B ┆ 1 │
|
2224
|
-
# # ├╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌┼╌╌╌╌╌╌╌╌┼╌╌╌╌╌╌╌╌┤
|
2225
2164
|
# # │ 2021-05-01 00:00:00 ┆ B ┆ 1 │
|
2226
|
-
# # ├╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌┼╌╌╌╌╌╌╌╌┼╌╌╌╌╌╌╌╌┤
|
2227
2165
|
# # │ 2021-06-01 00:00:00 ┆ B ┆ 3 │
|
2228
2166
|
# # └─────────────────────┴────────┴────────┘
|
2229
2167
|
def upsample(
|
@@ -2348,11 +2286,8 @@ module Polars
|
|
2348
2286
|
# # │ datetime[ns] ┆ f64 ┆ i64 │
|
2349
2287
|
# # ╞═════════════════════╪════════════╪══════╡
|
2350
2288
|
# # │ 2016-05-12 00:00:00 ┆ 82.19 ┆ 4164 │
|
2351
|
-
# # ├╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌┼╌╌╌╌╌╌╌╌╌╌╌╌┼╌╌╌╌╌╌┤
|
2352
2289
|
# # │ 2017-05-12 00:00:00 ┆ 82.66 ┆ 4411 │
|
2353
|
-
# # ├╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌┼╌╌╌╌╌╌╌╌╌╌╌╌┼╌╌╌╌╌╌┤
|
2354
2290
|
# # │ 2018-05-12 00:00:00 ┆ 83.12 ┆ 4566 │
|
2355
|
-
# # ├╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌┼╌╌╌╌╌╌╌╌╌╌╌╌┼╌╌╌╌╌╌┤
|
2356
2291
|
# # │ 2019-05-12 00:00:00 ┆ 83.52 ┆ 4696 │
|
2357
2292
|
# # └─────────────────────┴────────────┴──────┘
|
2358
2293
|
def join_asof(
|
@@ -2427,7 +2362,6 @@ module Polars
|
|
2427
2362
|
# # │ i64 ┆ f64 ┆ str ┆ str │
|
2428
2363
|
# # ╞═════╪═════╪═════╪═══════╡
|
2429
2364
|
# # │ 1 ┆ 6.0 ┆ a ┆ x │
|
2430
|
-
# # ├╌╌╌╌╌┼╌╌╌╌╌┼╌╌╌╌╌┼╌╌╌╌╌╌╌┤
|
2431
2365
|
# # │ 2 ┆ 7.0 ┆ b ┆ y │
|
2432
2366
|
# # └─────┴─────┴─────┴───────┘
|
2433
2367
|
#
|
@@ -2441,11 +2375,8 @@ module Polars
|
|
2441
2375
|
# # │ i64 ┆ f64 ┆ str ┆ str │
|
2442
2376
|
# # ╞══════╪══════╪═════╪═══════╡
|
2443
2377
|
# # │ 1 ┆ 6.0 ┆ a ┆ x │
|
2444
|
-
# # ├╌╌╌╌╌╌┼╌╌╌╌╌╌┼╌╌╌╌╌┼╌╌╌╌╌╌╌┤
|
2445
2378
|
# # │ 2 ┆ 7.0 ┆ b ┆ y │
|
2446
|
-
# # ├╌╌╌╌╌╌┼╌╌╌╌╌╌┼╌╌╌╌╌┼╌╌╌╌╌╌╌┤
|
2447
2379
|
# # │ null ┆ null ┆ d ┆ z │
|
2448
|
-
# # ├╌╌╌╌╌╌┼╌╌╌╌╌╌┼╌╌╌╌╌┼╌╌╌╌╌╌╌┤
|
2449
2380
|
# # │ 3 ┆ 8.0 ┆ c ┆ null │
|
2450
2381
|
# # └──────┴──────┴─────┴───────┘
|
2451
2382
|
#
|
@@ -2459,9 +2390,7 @@ module Polars
|
|
2459
2390
|
# # │ i64 ┆ f64 ┆ str ┆ str │
|
2460
2391
|
# # ╞═════╪═════╪═════╪═══════╡
|
2461
2392
|
# # │ 1 ┆ 6.0 ┆ a ┆ x │
|
2462
|
-
# # ├╌╌╌╌╌┼╌╌╌╌╌┼╌╌╌╌╌┼╌╌╌╌╌╌╌┤
|
2463
2393
|
# # │ 2 ┆ 7.0 ┆ b ┆ y │
|
2464
|
-
# # ├╌╌╌╌╌┼╌╌╌╌╌┼╌╌╌╌╌┼╌╌╌╌╌╌╌┤
|
2465
2394
|
# # │ 3 ┆ 8.0 ┆ c ┆ null │
|
2466
2395
|
# # └─────┴─────┴─────┴───────┘
|
2467
2396
|
#
|
@@ -2475,7 +2404,6 @@ module Polars
|
|
2475
2404
|
# # │ i64 ┆ f64 ┆ str │
|
2476
2405
|
# # ╞═════╪═════╪═════╡
|
2477
2406
|
# # │ 1 ┆ 6.0 ┆ a │
|
2478
|
-
# # ├╌╌╌╌╌┼╌╌╌╌╌┼╌╌╌╌╌┤
|
2479
2407
|
# # │ 2 ┆ 7.0 ┆ b │
|
2480
2408
|
# # └─────┴─────┴─────┘
|
2481
2409
|
#
|
@@ -2546,9 +2474,7 @@ module Polars
|
|
2546
2474
|
# # │ i64 ┆ i64 │
|
2547
2475
|
# # ╞══════════╪══════════╡
|
2548
2476
|
# # │ 2 ┆ -3 │
|
2549
|
-
# # ├╌╌╌╌╌╌╌╌╌╌┼╌╌╌╌╌╌╌╌╌╌┤
|
2550
2477
|
# # │ 4 ┆ 15 │
|
2551
|
-
# # ├╌╌╌╌╌╌╌╌╌╌┼╌╌╌╌╌╌╌╌╌╌┤
|
2552
2478
|
# # │ 6 ┆ 24 │
|
2553
2479
|
# # └──────────┴──────────┘
|
2554
2480
|
#
|
@@ -2562,9 +2488,7 @@ module Polars
|
|
2562
2488
|
# # │ i64 │
|
2563
2489
|
# # ╞═══════╡
|
2564
2490
|
# # │ 1 │
|
2565
|
-
# # ├╌╌╌╌╌╌╌┤
|
2566
2491
|
# # │ 9 │
|
2567
|
-
# # ├╌╌╌╌╌╌╌┤
|
2568
2492
|
# # │ 14 │
|
2569
2493
|
# # └───────┘
|
2570
2494
|
def apply(return_dtype: nil, inference_size: 256, &f)
|
@@ -2599,9 +2523,7 @@ module Polars
|
|
2599
2523
|
# # │ i64 ┆ i64 ┆ f64 │
|
2600
2524
|
# # ╞═════╪═════╪═══════════╡
|
2601
2525
|
# # │ 1 ┆ 2 ┆ 4.0 │
|
2602
|
-
# # ├╌╌╌╌╌┼╌╌╌╌╌┼╌╌╌╌╌╌╌╌╌╌╌┤
|
2603
2526
|
# # │ 3 ┆ 4 ┆ 16.0 │
|
2604
|
-
# # ├╌╌╌╌╌┼╌╌╌╌╌┼╌╌╌╌╌╌╌╌╌╌╌┤
|
2605
2527
|
# # │ 5 ┆ 6 ┆ 36.0 │
|
2606
2528
|
# # └─────┴─────┴───────────┘
|
2607
2529
|
#
|
@@ -2615,9 +2537,7 @@ module Polars
|
|
2615
2537
|
# # │ f64 ┆ i64 │
|
2616
2538
|
# # ╞══════╪═════╡
|
2617
2539
|
# # │ 1.0 ┆ 2 │
|
2618
|
-
# # ├╌╌╌╌╌╌┼╌╌╌╌╌┤
|
2619
2540
|
# # │ 9.0 ┆ 4 │
|
2620
|
-
# # ├╌╌╌╌╌╌┼╌╌╌╌╌┤
|
2621
2541
|
# # │ 25.0 ┆ 6 │
|
2622
2542
|
# # └──────┴─────┘
|
2623
2543
|
def with_column(column)
|
@@ -2653,9 +2573,7 @@ module Polars
|
|
2653
2573
|
# # │ i64 ┆ i64 ┆ str ┆ i64 │
|
2654
2574
|
# # ╞═════╪═════╪═════╪═══════╡
|
2655
2575
|
# # │ 1 ┆ 6 ┆ a ┆ 10 │
|
2656
|
-
# # ├╌╌╌╌╌┼╌╌╌╌╌┼╌╌╌╌╌┼╌╌╌╌╌╌╌┤
|
2657
2576
|
# # │ 2 ┆ 7 ┆ b ┆ 20 │
|
2658
|
-
# # ├╌╌╌╌╌┼╌╌╌╌╌┼╌╌╌╌╌┼╌╌╌╌╌╌╌┤
|
2659
2577
|
# # │ 3 ┆ 8 ┆ c ┆ 30 │
|
2660
2578
|
# # └─────┴─────┴─────┴───────┘
|
2661
2579
|
def hstack(columns, in_place: false)
|
@@ -2703,11 +2621,8 @@ module Polars
|
|
2703
2621
|
# # │ i64 ┆ i64 ┆ str │
|
2704
2622
|
# # ╞═════╪═════╪═════╡
|
2705
2623
|
# # │ 1 ┆ 6 ┆ a │
|
2706
|
-
# # ├╌╌╌╌╌┼╌╌╌╌╌┼╌╌╌╌╌┤
|
2707
2624
|
# # │ 2 ┆ 7 ┆ b │
|
2708
|
-
# # ├╌╌╌╌╌┼╌╌╌╌╌┼╌╌╌╌╌┤
|
2709
2625
|
# # │ 3 ┆ 8 ┆ c │
|
2710
|
-
# # ├╌╌╌╌╌┼╌╌╌╌╌┼╌╌╌╌╌┤
|
2711
2626
|
# # │ 4 ┆ 9 ┆ d │
|
2712
2627
|
# # └─────┴─────┴─────┘
|
2713
2628
|
def vstack(df, in_place: false)
|
@@ -2753,15 +2668,10 @@ module Polars
|
|
2753
2668
|
# # │ i64 ┆ i64 │
|
2754
2669
|
# # ╞═════╪═════╡
|
2755
2670
|
# # │ 1 ┆ 4 │
|
2756
|
-
# # ├╌╌╌╌╌┼╌╌╌╌╌┤
|
2757
2671
|
# # │ 2 ┆ 5 │
|
2758
|
-
# # ├╌╌╌╌╌┼╌╌╌╌╌┤
|
2759
2672
|
# # │ 3 ┆ 6 │
|
2760
|
-
# # ├╌╌╌╌╌┼╌╌╌╌╌┤
|
2761
2673
|
# # │ 10 ┆ 40 │
|
2762
|
-
# # ├╌╌╌╌╌┼╌╌╌╌╌┤
|
2763
2674
|
# # │ 20 ┆ 50 │
|
2764
|
-
# # ├╌╌╌╌╌┼╌╌╌╌╌┤
|
2765
2675
|
# # │ 30 ┆ 60 │
|
2766
2676
|
# # └─────┴─────┘
|
2767
2677
|
def extend(other)
|
@@ -2793,9 +2703,7 @@ module Polars
|
|
2793
2703
|
# # │ i64 ┆ f64 │
|
2794
2704
|
# # ╞═════╪═════╡
|
2795
2705
|
# # │ 1 ┆ 6.0 │
|
2796
|
-
# # ├╌╌╌╌╌┼╌╌╌╌╌┤
|
2797
2706
|
# # │ 2 ┆ 7.0 │
|
2798
|
-
# # ├╌╌╌╌╌┼╌╌╌╌╌┤
|
2799
2707
|
# # │ 3 ┆ 8.0 │
|
2800
2708
|
# # └─────┴─────┘
|
2801
2709
|
def drop(columns)
|
@@ -2926,11 +2834,8 @@ module Polars
|
|
2926
2834
|
# # │ i64 ┆ f64 │
|
2927
2835
|
# # ╞═════╪══════╡
|
2928
2836
|
# # │ 1 ┆ 0.5 │
|
2929
|
-
# # ├╌╌╌╌╌┼╌╌╌╌╌╌┤
|
2930
2837
|
# # │ 2 ┆ 4.0 │
|
2931
|
-
# # ├╌╌╌╌╌┼╌╌╌╌╌╌┤
|
2932
2838
|
# # │ 99 ┆ 99.0 │
|
2933
|
-
# # ├╌╌╌╌╌┼╌╌╌╌╌╌┤
|
2934
2839
|
# # │ 4 ┆ 13.0 │
|
2935
2840
|
# # └─────┴──────┘
|
2936
2841
|
#
|
@@ -2944,11 +2849,8 @@ module Polars
|
|
2944
2849
|
# # │ i64 ┆ f64 │
|
2945
2850
|
# # ╞═════╪══════╡
|
2946
2851
|
# # │ 1 ┆ 0.5 │
|
2947
|
-
# # ├╌╌╌╌╌┼╌╌╌╌╌╌┤
|
2948
2852
|
# # │ 2 ┆ 4.0 │
|
2949
|
-
# # ├╌╌╌╌╌┼╌╌╌╌╌╌┤
|
2950
2853
|
# # │ 2 ┆ 4.0 │
|
2951
|
-
# # ├╌╌╌╌╌┼╌╌╌╌╌╌┤
|
2952
2854
|
# # │ 4 ┆ 13.0 │
|
2953
2855
|
# # └─────┴──────┘
|
2954
2856
|
#
|
@@ -2962,11 +2864,8 @@ module Polars
|
|
2962
2864
|
# # │ i64 ┆ f64 │
|
2963
2865
|
# # ╞═════╪══════╡
|
2964
2866
|
# # │ 1 ┆ 0.5 │
|
2965
|
-
# # ├╌╌╌╌╌┼╌╌╌╌╌╌┤
|
2966
2867
|
# # │ 2 ┆ 4.0 │
|
2967
|
-
# # ├╌╌╌╌╌┼╌╌╌╌╌╌┤
|
2968
2868
|
# # │ 4 ┆ 13.0 │
|
2969
|
-
# # ├╌╌╌╌╌┼╌╌╌╌╌╌┤
|
2970
2869
|
# # │ 4 ┆ 13.0 │
|
2971
2870
|
# # └─────┴──────┘
|
2972
2871
|
#
|
@@ -2980,11 +2879,8 @@ module Polars
|
|
2980
2879
|
# # │ i64 ┆ f64 │
|
2981
2880
|
# # ╞═════╪══════╡
|
2982
2881
|
# # │ 1 ┆ 0.5 │
|
2983
|
-
# # ├╌╌╌╌╌┼╌╌╌╌╌╌┤
|
2984
2882
|
# # │ 2 ┆ 4.0 │
|
2985
|
-
# # ├╌╌╌╌╌┼╌╌╌╌╌╌┤
|
2986
2883
|
# # │ 0 ┆ 0.0 │
|
2987
|
-
# # ├╌╌╌╌╌┼╌╌╌╌╌╌┤
|
2988
2884
|
# # │ 4 ┆ 13.0 │
|
2989
2885
|
# # └─────┴──────┘
|
2990
2886
|
def fill_null(value = nil, strategy: nil, limit: nil, matches_supertype: true)
|
@@ -3023,11 +2919,8 @@ module Polars
|
|
3023
2919
|
# # │ f64 ┆ f64 │
|
3024
2920
|
# # ╞══════╪══════╡
|
3025
2921
|
# # │ 1.5 ┆ 0.5 │
|
3026
|
-
# # ├╌╌╌╌╌╌┼╌╌╌╌╌╌┤
|
3027
2922
|
# # │ 2.0 ┆ 4.0 │
|
3028
|
-
# # ├╌╌╌╌╌╌┼╌╌╌╌╌╌┤
|
3029
2923
|
# # │ 99.0 ┆ 99.0 │
|
3030
|
-
# # ├╌╌╌╌╌╌┼╌╌╌╌╌╌┤
|
3031
2924
|
# # │ 4.0 ┆ 13.0 │
|
3032
2925
|
# # └──────┴──────┘
|
3033
2926
|
def fill_nan(fill_value)
|
@@ -3057,19 +2950,12 @@ module Polars
|
|
3057
2950
|
# # │ str ┆ i64 │
|
3058
2951
|
# # ╞═════════╪═════════╡
|
3059
2952
|
# # │ a ┆ 1 │
|
3060
|
-
# # ├╌╌╌╌╌╌╌╌╌┼╌╌╌╌╌╌╌╌╌┤
|
3061
2953
|
# # │ a ┆ 2 │
|
3062
|
-
# # ├╌╌╌╌╌╌╌╌╌┼╌╌╌╌╌╌╌╌╌┤
|
3063
2954
|
# # │ a ┆ 3 │
|
3064
|
-
# # ├╌╌╌╌╌╌╌╌╌┼╌╌╌╌╌╌╌╌╌┤
|
3065
2955
|
# # │ b ┆ 4 │
|
3066
|
-
# # ├╌╌╌╌╌╌╌╌╌┼╌╌╌╌╌╌╌╌╌┤
|
3067
2956
|
# # │ b ┆ 5 │
|
3068
|
-
# # ├╌╌╌╌╌╌╌╌╌┼╌╌╌╌╌╌╌╌╌┤
|
3069
2957
|
# # │ c ┆ 6 │
|
3070
|
-
# # ├╌╌╌╌╌╌╌╌╌┼╌╌╌╌╌╌╌╌╌┤
|
3071
2958
|
# # │ c ┆ 7 │
|
3072
|
-
# # ├╌╌╌╌╌╌╌╌╌┼╌╌╌╌╌╌╌╌╌┤
|
3073
2959
|
# # │ c ┆ 8 │
|
3074
2960
|
# # └─────────┴─────────┘
|
3075
2961
|
def explode(columns)
|
@@ -3111,7 +2997,6 @@ module Polars
|
|
3111
2997
|
# # │ str ┆ i64 ┆ i64 ┆ i64 │
|
3112
2998
|
# # ╞═════╪═════╪═════╪═════╡
|
3113
2999
|
# # │ one ┆ 1 ┆ 2 ┆ 3 │
|
3114
|
-
# # ├╌╌╌╌╌┼╌╌╌╌╌┼╌╌╌╌╌┼╌╌╌╌╌┤
|
3115
3000
|
# # │ two ┆ 4 ┆ 5 ┆ 6 │
|
3116
3001
|
# # └─────┴─────┴─────┴─────┘
|
3117
3002
|
def pivot(
|
@@ -3120,7 +3005,8 @@ module Polars
|
|
3120
3005
|
columns:,
|
3121
3006
|
aggregate_fn: "first",
|
3122
3007
|
maintain_order: true,
|
3123
|
-
sort_columns: false
|
3008
|
+
sort_columns: false,
|
3009
|
+
separator: "_"
|
3124
3010
|
)
|
3125
3011
|
if values.is_a?(String)
|
3126
3012
|
values = [values]
|
@@ -3162,7 +3048,8 @@ module Polars
|
|
3162
3048
|
columns,
|
3163
3049
|
aggregate_fn._rbexpr,
|
3164
3050
|
maintain_order,
|
3165
|
-
sort_columns
|
3051
|
+
sort_columns,
|
3052
|
+
separator
|
3166
3053
|
)
|
3167
3054
|
)
|
3168
3055
|
end
|
@@ -3205,15 +3092,10 @@ module Polars
|
|
3205
3092
|
# # │ str ┆ str ┆ i64 │
|
3206
3093
|
# # ╞═════╪══════════╪═══════╡
|
3207
3094
|
# # │ x ┆ b ┆ 1 │
|
3208
|
-
# # ├╌╌╌╌╌┼╌╌╌╌╌╌╌╌╌╌┼╌╌╌╌╌╌╌┤
|
3209
3095
|
# # │ y ┆ b ┆ 3 │
|
3210
|
-
# # ├╌╌╌╌╌┼╌╌╌╌╌╌╌╌╌╌┼╌╌╌╌╌╌╌┤
|
3211
3096
|
# # │ z ┆ b ┆ 5 │
|
3212
|
-
# # ├╌╌╌╌╌┼╌╌╌╌╌╌╌╌╌╌┼╌╌╌╌╌╌╌┤
|
3213
3097
|
# # │ x ┆ c ┆ 2 │
|
3214
|
-
# # ├╌╌╌╌╌┼╌╌╌╌╌╌╌╌╌╌┼╌╌╌╌╌╌╌┤
|
3215
3098
|
# # │ y ┆ c ┆ 4 │
|
3216
|
-
# # ├╌╌╌╌╌┼╌╌╌╌╌╌╌╌╌╌┼╌╌╌╌╌╌╌┤
|
3217
3099
|
# # │ z ┆ c ┆ 6 │
|
3218
3100
|
# # └─────┴──────────┴───────┘
|
3219
3101
|
def melt(id_vars: nil, value_vars: nil, variable_name: nil, value_name: nil)
|
@@ -3268,21 +3150,13 @@ module Polars
|
|
3268
3150
|
# # │ str ┆ i64 │
|
3269
3151
|
# # ╞══════╪══════╡
|
3270
3152
|
# # │ A ┆ 0 │
|
3271
|
-
# # ├╌╌╌╌╌╌┼╌╌╌╌╌╌┤
|
3272
3153
|
# # │ B ┆ 1 │
|
3273
|
-
# # ├╌╌╌╌╌╌┼╌╌╌╌╌╌┤
|
3274
3154
|
# # │ C ┆ 2 │
|
3275
|
-
# # ├╌╌╌╌╌╌┼╌╌╌╌╌╌┤
|
3276
3155
|
# # │ D ┆ 3 │
|
3277
|
-
# # ├╌╌╌╌╌╌┼╌╌╌╌╌╌┤
|
3278
3156
|
# # │ ... ┆ ... │
|
3279
|
-
# # ├╌╌╌╌╌╌┼╌╌╌╌╌╌┤
|
3280
3157
|
# # │ F ┆ 5 │
|
3281
|
-
# # ├╌╌╌╌╌╌┼╌╌╌╌╌╌┤
|
3282
3158
|
# # │ G ┆ 6 │
|
3283
|
-
# # ├╌╌╌╌╌╌┼╌╌╌╌╌╌┤
|
3284
3159
|
# # │ H ┆ 7 │
|
3285
|
-
# # ├╌╌╌╌╌╌┼╌╌╌╌╌╌┤
|
3286
3160
|
# # │ I ┆ 8 │
|
3287
3161
|
# # └──────┴──────┘
|
3288
3162
|
#
|
@@ -3296,9 +3170,7 @@ module Polars
|
|
3296
3170
|
# # │ str ┆ str ┆ str ┆ i64 ┆ i64 ┆ i64 │
|
3297
3171
|
# # ╞════════╪════════╪════════╪════════╪════════╪════════╡
|
3298
3172
|
# # │ A ┆ D ┆ G ┆ 0 ┆ 3 ┆ 6 │
|
3299
|
-
# # ├╌╌╌╌╌╌╌╌┼╌╌╌╌╌╌╌╌┼╌╌╌╌╌╌╌╌┼╌╌╌╌╌╌╌╌┼╌╌╌╌╌╌╌╌┼╌╌╌╌╌╌╌╌┤
|
3300
3173
|
# # │ B ┆ E ┆ H ┆ 1 ┆ 4 ┆ 7 │
|
3301
|
-
# # ├╌╌╌╌╌╌╌╌┼╌╌╌╌╌╌╌╌┼╌╌╌╌╌╌╌╌┼╌╌╌╌╌╌╌╌┼╌╌╌╌╌╌╌╌┼╌╌╌╌╌╌╌╌┤
|
3302
3174
|
# # │ C ┆ F ┆ I ┆ 2 ┆ 5 ┆ 8 │
|
3303
3175
|
# # └────────┴────────┴────────┴────────┴────────┴────────┘
|
3304
3176
|
#
|
@@ -3312,9 +3184,7 @@ module Polars
|
|
3312
3184
|
# # │ str ┆ str ┆ str ┆ i64 ┆ i64 ┆ i64 │
|
3313
3185
|
# # ╞════════╪════════╪════════╪════════╪════════╪════════╡
|
3314
3186
|
# # │ A ┆ B ┆ C ┆ 0 ┆ 1 ┆ 2 │
|
3315
|
-
# # ├╌╌╌╌╌╌╌╌┼╌╌╌╌╌╌╌╌┼╌╌╌╌╌╌╌╌┼╌╌╌╌╌╌╌╌┼╌╌╌╌╌╌╌╌┼╌╌╌╌╌╌╌╌┤
|
3316
3187
|
# # │ D ┆ E ┆ F ┆ 3 ┆ 4 ┆ 5 │
|
3317
|
-
# # ├╌╌╌╌╌╌╌╌┼╌╌╌╌╌╌╌╌┼╌╌╌╌╌╌╌╌┼╌╌╌╌╌╌╌╌┼╌╌╌╌╌╌╌╌┼╌╌╌╌╌╌╌╌┤
|
3318
3188
|
# # │ G ┆ H ┆ I ┆ 6 ┆ 7 ┆ 8 │
|
3319
3189
|
# # └────────┴────────┴────────┴────────┴────────┴────────┘
|
3320
3190
|
def unstack(step:, how: "vertical", columns: nil, fill_values: nil)
|
@@ -3400,7 +3270,6 @@ module Polars
|
|
3400
3270
|
# # │ str ┆ i64 ┆ str │
|
3401
3271
|
# # ╞═════╪═════╪═════╡
|
3402
3272
|
# # │ A ┆ 1 ┆ k │
|
3403
|
-
# # ├╌╌╌╌╌┼╌╌╌╌╌┼╌╌╌╌╌┤
|
3404
3273
|
# # │ A ┆ 2 ┆ l │
|
3405
3274
|
# # └─────┴─────┴─────┘, shape: (2, 3)
|
3406
3275
|
# # ┌─────┬─────┬─────┐
|
@@ -3409,7 +3278,6 @@ module Polars
|
|
3409
3278
|
# # │ str ┆ i64 ┆ str │
|
3410
3279
|
# # ╞═════╪═════╪═════╡
|
3411
3280
|
# # │ B ┆ 2 ┆ m │
|
3412
|
-
# # ├╌╌╌╌╌┼╌╌╌╌╌┼╌╌╌╌╌┤
|
3413
3281
|
# # │ B ┆ 4 ┆ m │
|
3414
3282
|
# # └─────┴─────┴─────┘, shape: (1, 3)
|
3415
3283
|
# # ┌─────┬─────┬─────┐
|
@@ -3430,7 +3298,6 @@ module Polars
|
|
3430
3298
|
# # │ str ┆ i64 ┆ str │
|
3431
3299
|
# # ╞═════╪═════╪═════╡
|
3432
3300
|
# # │ A ┆ 1 ┆ k │
|
3433
|
-
# # ├╌╌╌╌╌┼╌╌╌╌╌┼╌╌╌╌╌┤
|
3434
3301
|
# # │ A ┆ 2 ┆ l │
|
3435
3302
|
# # └─────┴─────┴─────┘, "B"=>shape: (2, 3)
|
3436
3303
|
# # ┌─────┬─────┬─────┐
|
@@ -3439,7 +3306,6 @@ module Polars
|
|
3439
3306
|
# # │ str ┆ i64 ┆ str │
|
3440
3307
|
# # ╞═════╪═════╪═════╡
|
3441
3308
|
# # │ B ┆ 2 ┆ m │
|
3442
|
-
# # ├╌╌╌╌╌┼╌╌╌╌╌┼╌╌╌╌╌┤
|
3443
3309
|
# # │ B ┆ 4 ┆ m │
|
3444
3310
|
# # └─────┴─────┴─────┘, "C"=>shape: (1, 3)
|
3445
3311
|
# # ┌─────┬─────┬─────┐
|
@@ -3499,9 +3365,7 @@ module Polars
|
|
3499
3365
|
# # │ i64 ┆ i64 ┆ str │
|
3500
3366
|
# # ╞══════╪══════╪══════╡
|
3501
3367
|
# # │ null ┆ null ┆ null │
|
3502
|
-
# # ├╌╌╌╌╌╌┼╌╌╌╌╌╌┼╌╌╌╌╌╌┤
|
3503
3368
|
# # │ 1 ┆ 6 ┆ a │
|
3504
|
-
# # ├╌╌╌╌╌╌┼╌╌╌╌╌╌┼╌╌╌╌╌╌┤
|
3505
3369
|
# # │ 2 ┆ 7 ┆ b │
|
3506
3370
|
# # └──────┴──────┴──────┘
|
3507
3371
|
#
|
@@ -3515,9 +3379,7 @@ module Polars
|
|
3515
3379
|
# # │ i64 ┆ i64 ┆ str │
|
3516
3380
|
# # ╞══════╪══════╪══════╡
|
3517
3381
|
# # │ 2 ┆ 7 ┆ b │
|
3518
|
-
# # ├╌╌╌╌╌╌┼╌╌╌╌╌╌┼╌╌╌╌╌╌┤
|
3519
3382
|
# # │ 3 ┆ 8 ┆ c │
|
3520
|
-
# # ├╌╌╌╌╌╌┼╌╌╌╌╌╌┼╌╌╌╌╌╌┤
|
3521
3383
|
# # │ null ┆ null ┆ null │
|
3522
3384
|
# # └──────┴──────┴──────┘
|
3523
3385
|
def shift(periods)
|
@@ -3550,9 +3412,7 @@ module Polars
|
|
3550
3412
|
# # │ i64 ┆ i64 ┆ str │
|
3551
3413
|
# # ╞═════╪═════╪═════╡
|
3552
3414
|
# # │ 0 ┆ 0 ┆ 0 │
|
3553
|
-
# # ├╌╌╌╌╌┼╌╌╌╌╌┼╌╌╌╌╌┤
|
3554
3415
|
# # │ 1 ┆ 6 ┆ a │
|
3555
|
-
# # ├╌╌╌╌╌┼╌╌╌╌╌┼╌╌╌╌╌┤
|
3556
3416
|
# # │ 2 ┆ 7 ┆ b │
|
3557
3417
|
# # └─────┴─────┴─────┘
|
3558
3418
|
def shift_and_fill(periods, fill_value)
|
@@ -3642,9 +3502,7 @@ module Polars
|
|
3642
3502
|
# # │ i64 │
|
3643
3503
|
# # ╞═════╡
|
3644
3504
|
# # │ 1 │
|
3645
|
-
# # ├╌╌╌╌╌┤
|
3646
3505
|
# # │ 2 │
|
3647
|
-
# # ├╌╌╌╌╌┤
|
3648
3506
|
# # │ 3 │
|
3649
3507
|
# # └─────┘
|
3650
3508
|
#
|
@@ -3658,9 +3516,7 @@ module Polars
|
|
3658
3516
|
# # │ i64 ┆ i64 │
|
3659
3517
|
# # ╞═════╪═════╡
|
3660
3518
|
# # │ 1 ┆ 6 │
|
3661
|
-
# # ├╌╌╌╌╌┼╌╌╌╌╌┤
|
3662
3519
|
# # │ 2 ┆ 7 │
|
3663
|
-
# # ├╌╌╌╌╌┼╌╌╌╌╌┤
|
3664
3520
|
# # │ 3 ┆ 8 │
|
3665
3521
|
# # └─────┴─────┘
|
3666
3522
|
#
|
@@ -3674,9 +3530,7 @@ module Polars
|
|
3674
3530
|
# # │ i64 │
|
3675
3531
|
# # ╞═════╡
|
3676
3532
|
# # │ 2 │
|
3677
|
-
# # ├╌╌╌╌╌┤
|
3678
3533
|
# # │ 3 │
|
3679
|
-
# # ├╌╌╌╌╌┤
|
3680
3534
|
# # │ 4 │
|
3681
3535
|
# # └─────┘
|
3682
3536
|
#
|
@@ -3690,9 +3544,7 @@ module Polars
|
|
3690
3544
|
# # │ i64 ┆ i64 │
|
3691
3545
|
# # ╞═════╪═════╡
|
3692
3546
|
# # │ 2 ┆ 7 │
|
3693
|
-
# # ├╌╌╌╌╌┼╌╌╌╌╌┤
|
3694
3547
|
# # │ 3 ┆ 8 │
|
3695
|
-
# # ├╌╌╌╌╌┼╌╌╌╌╌┤
|
3696
3548
|
# # │ 4 ┆ 9 │
|
3697
3549
|
# # └─────┴─────┘
|
3698
3550
|
#
|
@@ -3706,9 +3558,7 @@ module Polars
|
|
3706
3558
|
# # │ i64 │
|
3707
3559
|
# # ╞═════════╡
|
3708
3560
|
# # │ 0 │
|
3709
|
-
# # ├╌╌╌╌╌╌╌╌╌┤
|
3710
3561
|
# # │ 0 │
|
3711
|
-
# # ├╌╌╌╌╌╌╌╌╌┤
|
3712
3562
|
# # │ 10 │
|
3713
3563
|
# # └─────────┘
|
3714
3564
|
def select(exprs)
|
@@ -3750,11 +3600,8 @@ module Polars
|
|
3750
3600
|
# # │ i64 ┆ f64 ┆ bool ┆ f64 ┆ f64 ┆ bool │
|
3751
3601
|
# # ╞═════╪══════╪═══════╪══════╪══════╪═══════╡
|
3752
3602
|
# # │ 1 ┆ 0.5 ┆ true ┆ 1.0 ┆ 0.25 ┆ false │
|
3753
|
-
# # ├╌╌╌╌╌┼╌╌╌╌╌╌┼╌╌╌╌╌╌╌┼╌╌╌╌╌╌┼╌╌╌╌╌╌┼╌╌╌╌╌╌╌┤
|
3754
3603
|
# # │ 2 ┆ 4.0 ┆ true ┆ 4.0 ┆ 2.0 ┆ false │
|
3755
|
-
# # ├╌╌╌╌╌┼╌╌╌╌╌╌┼╌╌╌╌╌╌╌┼╌╌╌╌╌╌┼╌╌╌╌╌╌┼╌╌╌╌╌╌╌┤
|
3756
3604
|
# # │ 3 ┆ 10.0 ┆ false ┆ 9.0 ┆ 5.0 ┆ true │
|
3757
|
-
# # ├╌╌╌╌╌┼╌╌╌╌╌╌┼╌╌╌╌╌╌╌┼╌╌╌╌╌╌┼╌╌╌╌╌╌┼╌╌╌╌╌╌╌┤
|
3758
3605
|
# # │ 4 ┆ 13.0 ┆ true ┆ 16.0 ┆ 6.5 ┆ false │
|
3759
3606
|
# # └─────┴──────┴───────┴──────┴──────┴───────┘
|
3760
3607
|
def with_columns(exprs)
|
@@ -4137,14 +3984,13 @@ module Polars
|
|
4137
3984
|
# # │ u8 ┆ u8 ┆ u8 ┆ u8 ┆ u8 ┆ u8 │
|
4138
3985
|
# # ╞═══════╪═══════╪═══════╪═══════╪═══════╪═══════╡
|
4139
3986
|
# # │ 1 ┆ 0 ┆ 1 ┆ 0 ┆ 1 ┆ 0 │
|
4140
|
-
# # ├╌╌╌╌╌╌╌┼╌╌╌╌╌╌╌┼╌╌╌╌╌╌╌┼╌╌╌╌╌╌╌┼╌╌╌╌╌╌╌┼╌╌╌╌╌╌╌┤
|
4141
3987
|
# # │ 0 ┆ 1 ┆ 0 ┆ 1 ┆ 0 ┆ 1 │
|
4142
3988
|
# # └───────┴───────┴───────┴───────┴───────┴───────┘
|
4143
|
-
def to_dummies(columns: nil)
|
3989
|
+
def to_dummies(columns: nil, separator: "_")
|
4144
3990
|
if columns.is_a?(String)
|
4145
3991
|
columns = [columns]
|
4146
3992
|
end
|
4147
|
-
_from_rbdf(_df.to_dummies(columns))
|
3993
|
+
_from_rbdf(_df.to_dummies(columns, separator))
|
4148
3994
|
end
|
4149
3995
|
|
4150
3996
|
# Drop duplicate rows from this DataFrame.
|
@@ -4180,13 +4026,9 @@ module Polars
|
|
4180
4026
|
# # │ i64 ┆ f64 ┆ bool │
|
4181
4027
|
# # ╞═════╪═════╪═══════╡
|
4182
4028
|
# # │ 1 ┆ 0.5 ┆ true │
|
4183
|
-
# # ├╌╌╌╌╌┼╌╌╌╌╌┼╌╌╌╌╌╌╌┤
|
4184
4029
|
# # │ 2 ┆ 1.0 ┆ true │
|
4185
|
-
# # ├╌╌╌╌╌┼╌╌╌╌╌┼╌╌╌╌╌╌╌┤
|
4186
4030
|
# # │ 3 ┆ 2.0 ┆ false │
|
4187
|
-
# # ├╌╌╌╌╌┼╌╌╌╌╌┼╌╌╌╌╌╌╌┤
|
4188
4031
|
# # │ 4 ┆ 3.0 ┆ true │
|
4189
|
-
# # ├╌╌╌╌╌┼╌╌╌╌╌┼╌╌╌╌╌╌╌┤
|
4190
4032
|
# # │ 5 ┆ 3.0 ┆ true │
|
4191
4033
|
# # └─────┴─────┴───────┘
|
4192
4034
|
def unique(maintain_order: true, subset: nil, keep: "first")
|
@@ -4320,7 +4162,6 @@ module Polars
|
|
4320
4162
|
# # │ i64 ┆ i64 ┆ str │
|
4321
4163
|
# # ╞═════╪═════╪═════╡
|
4322
4164
|
# # │ 3 ┆ 8 ┆ c │
|
4323
|
-
# # ├╌╌╌╌╌┼╌╌╌╌╌┼╌╌╌╌╌┤
|
4324
4165
|
# # │ 2 ┆ 7 ┆ b │
|
4325
4166
|
# # └─────┴─────┴─────┘
|
4326
4167
|
def sample(
|
@@ -4440,6 +4281,10 @@ module Polars
|
|
4440
4281
|
# Row index.
|
4441
4282
|
# @param by_predicate [Object]
|
4442
4283
|
# Select the row according to a given expression/predicate.
|
4284
|
+
# @param named [Boolean]
|
4285
|
+
# Return a hash instead of an array. The hash is a mapping of
|
4286
|
+
# column name to row value. This is more expensive than returning an
|
4287
|
+
# array, but allows for accessing values by column name.
|
4443
4288
|
#
|
4444
4289
|
# @return [Object]
|
4445
4290
|
#
|
@@ -4462,25 +4307,44 @@ module Polars
|
|
4462
4307
|
# df.row(2)
|
4463
4308
|
# # => [3, 8, "c"]
|
4464
4309
|
#
|
4310
|
+
# @example Get a hash instead with a mapping of column names to row values
|
4311
|
+
# df.row(2, named: true)
|
4312
|
+
# # => {"foo"=>3, "bar"=>8, "ham"=>"c"}
|
4313
|
+
#
|
4465
4314
|
# @example Return the row that matches the given predicate
|
4466
4315
|
# df.row(by_predicate: Polars.col("ham") == "b")
|
4467
4316
|
# # => [2, 7, "b"]
|
4468
|
-
def row(index = nil, by_predicate: nil)
|
4317
|
+
def row(index = nil, by_predicate: nil, named: false)
|
4469
4318
|
if !index.nil? && !by_predicate.nil?
|
4470
4319
|
raise ArgumentError, "Cannot set both 'index' and 'by_predicate'; mutually exclusive"
|
4471
4320
|
elsif index.is_a?(Expr)
|
4472
4321
|
raise TypeError, "Expressions should be passed to the 'by_predicate' param"
|
4473
|
-
|
4474
|
-
|
4475
|
-
|
4322
|
+
end
|
4323
|
+
|
4324
|
+
if !index.nil?
|
4325
|
+
row = _df.row_tuple(index)
|
4326
|
+
if named
|
4327
|
+
columns.zip(row).to_h
|
4328
|
+
else
|
4329
|
+
row
|
4330
|
+
end
|
4331
|
+
elsif !by_predicate.nil?
|
4332
|
+
if !by_predicate.is_a?(Expr)
|
4333
|
+
raise TypeError, "Expected by_predicate to be an expression; found #{by_predicate.class.name}"
|
4334
|
+
end
|
4476
4335
|
rows = filter(by_predicate).rows
|
4477
4336
|
n_rows = rows.length
|
4478
4337
|
if n_rows > 1
|
4479
4338
|
raise TooManyRowsReturned, "Predicate #{by_predicate} returned #{n_rows} rows"
|
4480
4339
|
elsif n_rows == 0
|
4481
|
-
raise NoRowsReturned, "Predicate
|
4340
|
+
raise NoRowsReturned, "Predicate #{by_predicate} returned no rows"
|
4341
|
+
end
|
4342
|
+
row = rows[0]
|
4343
|
+
if named
|
4344
|
+
columns.zip(row).to_h
|
4345
|
+
else
|
4346
|
+
row
|
4482
4347
|
end
|
4483
|
-
rows[0]
|
4484
4348
|
else
|
4485
4349
|
raise ArgumentError, "One of 'index' or 'by_predicate' must be set"
|
4486
4350
|
end
|
@@ -4488,6 +4352,11 @@ module Polars
|
|
4488
4352
|
|
4489
4353
|
# Convert columnar data to rows as Ruby arrays.
|
4490
4354
|
#
|
4355
|
+
# @param named [Boolean]
|
4356
|
+
# Return hashes instead of arrays. The hashes are a mapping of
|
4357
|
+
# column name to row value. This is more expensive than returning an
|
4358
|
+
# array, but allows for accessing values by column name.
|
4359
|
+
#
|
4491
4360
|
# @return [Array]
|
4492
4361
|
#
|
4493
4362
|
# @example
|
@@ -4499,8 +4368,79 @@ module Polars
|
|
4499
4368
|
# )
|
4500
4369
|
# df.rows
|
4501
4370
|
# # => [[1, 2], [3, 4], [5, 6]]
|
4502
|
-
|
4503
|
-
|
4371
|
+
# @example
|
4372
|
+
# df.rows(named: true)
|
4373
|
+
# # => [{"a"=>1, "b"=>2}, {"a"=>3, "b"=>4}, {"a"=>5, "b"=>6}]
|
4374
|
+
def rows(named: false)
|
4375
|
+
if named
|
4376
|
+
columns = columns()
|
4377
|
+
_df.row_tuples.map do |v|
|
4378
|
+
columns.zip(v).to_h
|
4379
|
+
end
|
4380
|
+
else
|
4381
|
+
_df.row_tuples
|
4382
|
+
end
|
4383
|
+
end
|
4384
|
+
|
4385
|
+
# Returns an iterator over the DataFrame of rows of python-native values.
|
4386
|
+
#
|
4387
|
+
# @param named [Boolean]
|
4388
|
+
# Return hashes instead of arrays. The hashes are a mapping of
|
4389
|
+
# column name to row value. This is more expensive than returning an
|
4390
|
+
# array, but allows for accessing values by column name.
|
4391
|
+
# @param buffer_size [Integer]
|
4392
|
+
# Determines the number of rows that are buffered internally while iterating
|
4393
|
+
# over the data; you should only modify this in very specific cases where the
|
4394
|
+
# default value is determined not to be a good fit to your access pattern, as
|
4395
|
+
# the speedup from using the buffer is significant (~2-4x). Setting this
|
4396
|
+
# value to zero disables row buffering.
|
4397
|
+
#
|
4398
|
+
# @return [Object]
|
4399
|
+
#
|
4400
|
+
# @example
|
4401
|
+
# df = Polars::DataFrame.new(
|
4402
|
+
# {
|
4403
|
+
# "a" => [1, 3, 5],
|
4404
|
+
# "b" => [2, 4, 6]
|
4405
|
+
# }
|
4406
|
+
# )
|
4407
|
+
# df.iter_rows.map { |row| row[0] }
|
4408
|
+
# # => [1, 3, 5]
|
4409
|
+
#
|
4410
|
+
# @example
|
4411
|
+
# df.iter_rows(named: true).map { |row| row["b"] }
|
4412
|
+
# # => [2, 4, 6]
|
4413
|
+
def iter_rows(named: false, buffer_size: 500, &block)
|
4414
|
+
return to_enum(:iter_rows, named: named, buffer_size: buffer_size) unless block_given?
|
4415
|
+
|
4416
|
+
# load into the local namespace for a modest performance boost in the hot loops
|
4417
|
+
columns = columns()
|
4418
|
+
|
4419
|
+
# note: buffering rows results in a 2-4x speedup over individual calls
|
4420
|
+
# to ".row(i)", so it should only be disabled in extremely specific cases.
|
4421
|
+
if buffer_size
|
4422
|
+
offset = 0
|
4423
|
+
while offset < height
|
4424
|
+
zerocopy_slice = slice(offset, buffer_size)
|
4425
|
+
rows_chunk = zerocopy_slice.rows(named: false)
|
4426
|
+
if named
|
4427
|
+
rows_chunk.each do |row|
|
4428
|
+
yield columns.zip(row).to_h
|
4429
|
+
end
|
4430
|
+
else
|
4431
|
+
rows_chunk.each(&block)
|
4432
|
+
end
|
4433
|
+
offset += buffer_size
|
4434
|
+
end
|
4435
|
+
elsif named
|
4436
|
+
height.times do |i|
|
4437
|
+
yield columns.zip(row(i)).to_h
|
4438
|
+
end
|
4439
|
+
else
|
4440
|
+
height.times do |i|
|
4441
|
+
yield row(i)
|
4442
|
+
end
|
4443
|
+
end
|
4504
4444
|
end
|
4505
4445
|
|
4506
4446
|
# Shrink DataFrame memory usage.
|
@@ -4534,7 +4474,6 @@ module Polars
|
|
4534
4474
|
# # │ i64 ┆ i64 │
|
4535
4475
|
# # ╞═════╪═════╡
|
4536
4476
|
# # │ 1 ┆ 5 │
|
4537
|
-
# # ├╌╌╌╌╌┼╌╌╌╌╌┤
|
4538
4477
|
# # │ 3 ┆ 7 │
|
4539
4478
|
# # └─────┴─────┘
|
4540
4479
|
def take_every(n)
|
@@ -4602,11 +4541,8 @@ module Polars
|
|
4602
4541
|
# # │ i64 ┆ i64 ┆ i64 │
|
4603
4542
|
# # ╞═════╪══════╪═════╡
|
4604
4543
|
# # │ 1 ┆ 6 ┆ 1 │
|
4605
|
-
# # ├╌╌╌╌╌┼╌╌╌╌╌╌┼╌╌╌╌╌┤
|
4606
4544
|
# # │ 5 ┆ 7 ┆ 3 │
|
4607
|
-
# # ├╌╌╌╌╌┼╌╌╌╌╌╌┼╌╌╌╌╌┤
|
4608
4545
|
# # │ 9 ┆ 9 ┆ 6 │
|
4609
|
-
# # ├╌╌╌╌╌┼╌╌╌╌╌╌┼╌╌╌╌╌┤
|
4610
4546
|
# # │ 10 ┆ null ┆ 9 │
|
4611
4547
|
# # └─────┴──────┴─────┘
|
4612
4548
|
def interpolate
|
@@ -4687,7 +4623,6 @@ module Polars
|
|
4687
4623
|
# # │ str ┆ i64 ┆ str ┆ bool ┆ list[i64] ┆ str │
|
4688
4624
|
# # ╞════════╪═════╪═════╪══════╪═══════════╪═══════╡
|
4689
4625
|
# # │ foo ┆ 1 ┆ a ┆ true ┆ [1, 2] ┆ baz │
|
4690
|
-
# # ├╌╌╌╌╌╌╌╌┼╌╌╌╌╌┼╌╌╌╌╌┼╌╌╌╌╌╌┼╌╌╌╌╌╌╌╌╌╌╌┼╌╌╌╌╌╌╌┤
|
4691
4626
|
# # │ bar ┆ 2 ┆ b ┆ null ┆ [3] ┆ womp │
|
4692
4627
|
# # └────────┴─────┴─────┴──────┴───────────┴───────┘
|
4693
4628
|
def unnest(names)
|