polars-df 0.13.0-x86_64-darwin → 0.15.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 +30 -0
- data/Cargo.lock +1368 -319
- data/LICENSE-THIRD-PARTY.txt +24439 -12853
- data/LICENSE.txt +1 -0
- data/README.md +1 -2
- data/lib/polars/3.1/polars.bundle +0 -0
- data/lib/polars/3.2/polars.bundle +0 -0
- data/lib/polars/3.3/polars.bundle +0 -0
- 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 +4 -3
- data/lib/polars/functions.rb +0 -57
@@ -133,6 +133,17 @@ module Polars
|
|
133
133
|
# Sum all the arrays in the list.
|
134
134
|
#
|
135
135
|
# @return [Series]
|
136
|
+
#
|
137
|
+
# @example
|
138
|
+
# s = Polars::Series.new("values", [[1], [2, 3]])
|
139
|
+
# s.list.sum
|
140
|
+
# # =>
|
141
|
+
# # shape: (2,)
|
142
|
+
# # Series: 'values' [i64]
|
143
|
+
# # [
|
144
|
+
# # 1
|
145
|
+
# # 5
|
146
|
+
# # ]
|
136
147
|
def sum
|
137
148
|
super
|
138
149
|
end
|
@@ -140,6 +151,17 @@ module Polars
|
|
140
151
|
# Compute the max value of the arrays in the list.
|
141
152
|
#
|
142
153
|
# @return [Series]
|
154
|
+
#
|
155
|
+
# @example
|
156
|
+
# s = Polars::Series.new("values", [[4, 1], [2, 3]])
|
157
|
+
# s.list.max
|
158
|
+
# # =>
|
159
|
+
# # shape: (2,)
|
160
|
+
# # Series: 'values' [i64]
|
161
|
+
# # [
|
162
|
+
# # 4
|
163
|
+
# # 3
|
164
|
+
# # ]
|
143
165
|
def max
|
144
166
|
super
|
145
167
|
end
|
@@ -147,6 +169,17 @@ module Polars
|
|
147
169
|
# Compute the min value of the arrays in the list.
|
148
170
|
#
|
149
171
|
# @return [Series]
|
172
|
+
#
|
173
|
+
# @example
|
174
|
+
# s = Polars::Series.new("values", [[4, 1], [2, 3]])
|
175
|
+
# s.list.min
|
176
|
+
# # =>
|
177
|
+
# # shape: (2,)
|
178
|
+
# # Series: 'values' [i64]
|
179
|
+
# # [
|
180
|
+
# # 1
|
181
|
+
# # 2
|
182
|
+
# # ]
|
150
183
|
def min
|
151
184
|
super
|
152
185
|
end
|
@@ -154,6 +187,17 @@ module Polars
|
|
154
187
|
# Compute the mean value of the arrays in the list.
|
155
188
|
#
|
156
189
|
# @return [Series]
|
190
|
+
#
|
191
|
+
# @example
|
192
|
+
# s = Polars::Series.new("values", [[3, 1], [3, 3]])
|
193
|
+
# s.list.mean
|
194
|
+
# # =>
|
195
|
+
# # shape: (2,)
|
196
|
+
# # Series: 'values' [f64]
|
197
|
+
# # [
|
198
|
+
# # 2.0
|
199
|
+
# # 3.0
|
200
|
+
# # ]
|
157
201
|
def mean
|
158
202
|
super
|
159
203
|
end
|
@@ -161,6 +205,27 @@ module Polars
|
|
161
205
|
# Sort the arrays in the list.
|
162
206
|
#
|
163
207
|
# @return [Series]
|
208
|
+
#
|
209
|
+
# @example
|
210
|
+
# s = Polars::Series.new("a", [[3, 2, 1], [9, 1, 2]])
|
211
|
+
# s.list.sort
|
212
|
+
# # =>
|
213
|
+
# # shape: (2,)
|
214
|
+
# # Series: 'a' [list[i64]]
|
215
|
+
# # [
|
216
|
+
# # [1, 2, 3]
|
217
|
+
# # [1, 2, 9]
|
218
|
+
# # ]
|
219
|
+
#
|
220
|
+
# @example
|
221
|
+
# s.list.sort(reverse: true)
|
222
|
+
# # =>
|
223
|
+
# # shape: (2,)
|
224
|
+
# # Series: 'a' [list[i64]]
|
225
|
+
# # [
|
226
|
+
# # [3, 2, 1]
|
227
|
+
# # [9, 2, 1]
|
228
|
+
# # ]
|
164
229
|
def sort(reverse: false)
|
165
230
|
super
|
166
231
|
end
|
@@ -168,6 +233,17 @@ module Polars
|
|
168
233
|
# Reverse the arrays in the list.
|
169
234
|
#
|
170
235
|
# @return [Series]
|
236
|
+
#
|
237
|
+
# @example
|
238
|
+
# s = Polars::Series.new("a", [[3, 2, 1], [9, 1, 2]])
|
239
|
+
# s.list.reverse
|
240
|
+
# # =>
|
241
|
+
# # shape: (2,)
|
242
|
+
# # Series: 'a' [list[i64]]
|
243
|
+
# # [
|
244
|
+
# # [1, 2, 3]
|
245
|
+
# # [2, 1, 9]
|
246
|
+
# # ]
|
171
247
|
def reverse
|
172
248
|
super
|
173
249
|
end
|
@@ -175,6 +251,17 @@ module Polars
|
|
175
251
|
# Get the unique/distinct values in the list.
|
176
252
|
#
|
177
253
|
# @return [Series]
|
254
|
+
#
|
255
|
+
# @example
|
256
|
+
# s = Polars::Series.new("a", [[1, 1, 2], [2, 3, 3]])
|
257
|
+
# s.list.unique()
|
258
|
+
# # =>
|
259
|
+
# # shape: (2,)
|
260
|
+
# # Series: 'a' [list[i64]]
|
261
|
+
# # [
|
262
|
+
# # [1, 2]
|
263
|
+
# # [2, 3]
|
264
|
+
# # ]
|
178
265
|
def unique
|
179
266
|
super
|
180
267
|
end
|
@@ -185,6 +272,18 @@ module Polars
|
|
185
272
|
# Columns to concat into a List Series
|
186
273
|
#
|
187
274
|
# @return [Series]
|
275
|
+
#
|
276
|
+
# @example
|
277
|
+
# s1 = Polars::Series.new("a", [["a", "b"], ["c"]])
|
278
|
+
# s2 = Polars::Series.new("b", [["c"], ["d", nil]])
|
279
|
+
# s1.list.concat(s2)
|
280
|
+
# # =>
|
281
|
+
# # shape: (2,)
|
282
|
+
# # Series: 'a' [list[str]]
|
283
|
+
# # [
|
284
|
+
# # ["a", "b", "c"]
|
285
|
+
# # ["c", "d", null]
|
286
|
+
# # ]
|
188
287
|
def concat(other)
|
189
288
|
super
|
190
289
|
end
|
@@ -203,6 +302,18 @@ module Polars
|
|
203
302
|
# false -> raise an error
|
204
303
|
#
|
205
304
|
# @return [Series]
|
305
|
+
#
|
306
|
+
# @example
|
307
|
+
# s = Polars::Series.new("a", [[3, 2, 1], [], [1, 2]])
|
308
|
+
# s.list.get(0, null_on_oob: true)
|
309
|
+
# # =>
|
310
|
+
# # shape: (3,)
|
311
|
+
# # Series: 'a' [i64]
|
312
|
+
# # [
|
313
|
+
# # 3
|
314
|
+
# # null
|
315
|
+
# # 1
|
316
|
+
# # ]
|
206
317
|
def get(index, null_on_oob: false)
|
207
318
|
super
|
208
319
|
end
|
@@ -240,6 +351,18 @@ module Polars
|
|
240
351
|
# Get the first value of the sublists.
|
241
352
|
#
|
242
353
|
# @return [Series]
|
354
|
+
#
|
355
|
+
# @example
|
356
|
+
# s = Polars::Series.new("a", [[3, 2, 1], [], [1, 2]])
|
357
|
+
# s.list.first
|
358
|
+
# # =>
|
359
|
+
# # shape: (3,)
|
360
|
+
# # Series: 'a' [i64]
|
361
|
+
# # [
|
362
|
+
# # 3
|
363
|
+
# # null
|
364
|
+
# # 1
|
365
|
+
# # ]
|
243
366
|
def first
|
244
367
|
super
|
245
368
|
end
|
@@ -247,6 +370,18 @@ module Polars
|
|
247
370
|
# Get the last value of the sublists.
|
248
371
|
#
|
249
372
|
# @return [Series]
|
373
|
+
#
|
374
|
+
# @example
|
375
|
+
# s = Polars::Series.new("a", [[3, 2, 1], [], [1, 2]])
|
376
|
+
# s.list.last
|
377
|
+
# # =>
|
378
|
+
# # shape: (3,)
|
379
|
+
# # Series: 'a' [i64]
|
380
|
+
# # [
|
381
|
+
# # 1
|
382
|
+
# # null
|
383
|
+
# # 2
|
384
|
+
# # ]
|
250
385
|
def last
|
251
386
|
super
|
252
387
|
end
|
@@ -257,6 +392,18 @@ module Polars
|
|
257
392
|
# Item that will be checked for membership.
|
258
393
|
#
|
259
394
|
# @return [Series]
|
395
|
+
#
|
396
|
+
# @example
|
397
|
+
# s = Polars::Series.new("a", [[3, 2, 1], [], [1, 2]])
|
398
|
+
# s.list.contains(1)
|
399
|
+
# # =>
|
400
|
+
# # shape: (3,)
|
401
|
+
# # Series: 'a' [bool]
|
402
|
+
# # [
|
403
|
+
# # true
|
404
|
+
# # false
|
405
|
+
# # true
|
406
|
+
# # ]
|
260
407
|
def contains(item)
|
261
408
|
super
|
262
409
|
end
|
@@ -264,6 +411,17 @@ module Polars
|
|
264
411
|
# Retrieve the index of the minimal value in every sublist.
|
265
412
|
#
|
266
413
|
# @return [Series]
|
414
|
+
#
|
415
|
+
# @example
|
416
|
+
# s = Polars::Series.new("a", [[1, 2], [2, 1]])
|
417
|
+
# s.list.arg_min
|
418
|
+
# # =>
|
419
|
+
# # shape: (2,)
|
420
|
+
# # Series: 'a' [u32]
|
421
|
+
# # [
|
422
|
+
# # 0
|
423
|
+
# # 1
|
424
|
+
# # ]
|
267
425
|
def arg_min
|
268
426
|
super
|
269
427
|
end
|
@@ -271,6 +429,17 @@ module Polars
|
|
271
429
|
# Retrieve the index of the maximum value in every sublist.
|
272
430
|
#
|
273
431
|
# @return [Series]
|
432
|
+
#
|
433
|
+
# @example
|
434
|
+
# s = Polars::Series.new("a", [[1, 2], [2, 1]])
|
435
|
+
# s.list.arg_max
|
436
|
+
# # =>
|
437
|
+
# # shape: (2,)
|
438
|
+
# # Series: 'a' [u32]
|
439
|
+
# # [
|
440
|
+
# # 1
|
441
|
+
# # 0
|
442
|
+
# # ]
|
274
443
|
def arg_max
|
275
444
|
super
|
276
445
|
end
|