polars-df 0.15.0-x86_64-linux-musl → 0.16.0-x86_64-linux-musl
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +10 -0
- data/Cargo.lock +588 -456
- data/LICENSE-THIRD-PARTY.txt +14507 -15568
- data/README.md +37 -2
- data/lib/polars/3.2/polars.so +0 -0
- data/lib/polars/3.3/polars.so +0 -0
- data/lib/polars/{3.1 → 3.4}/polars.so +0 -0
- data/lib/polars/data_frame.rb +179 -51
- data/lib/polars/data_types.rb +1 -1
- data/lib/polars/functions/aggregation/horizontal.rb +10 -4
- data/lib/polars/functions/lazy.rb +7 -3
- data/lib/polars/io/delta.rb +126 -0
- data/lib/polars/lazy_frame.rb +35 -5
- data/lib/polars/selectors.rb +85 -3
- data/lib/polars/version.rb +1 -1
- data/lib/polars.rb +15 -0
- metadata +8 -8
data/lib/polars/selectors.rb
CHANGED
@@ -372,9 +372,91 @@ module Polars
|
|
372
372
|
# def by_index
|
373
373
|
# end
|
374
374
|
|
375
|
-
#
|
376
|
-
#
|
377
|
-
#
|
375
|
+
# Select all columns matching the given names.
|
376
|
+
#
|
377
|
+
# @param names [Array]
|
378
|
+
# One or more names of columns to select.
|
379
|
+
# @param require_all [Boolean]
|
380
|
+
# Whether to match *all* names (the default) or *any* of the names.
|
381
|
+
#
|
382
|
+
# @return [SelectorProxy]
|
383
|
+
#
|
384
|
+
# @note
|
385
|
+
# Matching columns are returned in the order in which they are declared in
|
386
|
+
# the selector, not the underlying schema order.
|
387
|
+
#
|
388
|
+
# @example
|
389
|
+
# df = Polars::DataFrame.new(
|
390
|
+
# {
|
391
|
+
# "foo" => ["x", "y"],
|
392
|
+
# "bar" => [123, 456],
|
393
|
+
# "baz" => [2.0, 5.5],
|
394
|
+
# "zap" => [false, true]
|
395
|
+
# }
|
396
|
+
# )
|
397
|
+
#
|
398
|
+
# @example Select columns by name:
|
399
|
+
# df.select(Polars.cs.by_name("foo", "bar"))
|
400
|
+
# # =>
|
401
|
+
# # shape: (2, 2)
|
402
|
+
# # ┌─────┬─────┐
|
403
|
+
# # │ foo ┆ bar │
|
404
|
+
# # │ --- ┆ --- │
|
405
|
+
# # │ str ┆ i64 │
|
406
|
+
# # ╞═════╪═════╡
|
407
|
+
# # │ x ┆ 123 │
|
408
|
+
# # │ y ┆ 456 │
|
409
|
+
# # └─────┴─────┘
|
410
|
+
#
|
411
|
+
# @example Match *any* of the given columns by name:
|
412
|
+
# df.select(Polars.cs.by_name("baz", "moose", "foo", "bear", require_all: false))
|
413
|
+
# # =>
|
414
|
+
# # shape: (2, 2)
|
415
|
+
# # ┌─────┬─────┐
|
416
|
+
# # │ foo ┆ baz │
|
417
|
+
# # │ --- ┆ --- │
|
418
|
+
# # │ str ┆ f64 │
|
419
|
+
# # ╞═════╪═════╡
|
420
|
+
# # │ x ┆ 2.0 │
|
421
|
+
# # │ y ┆ 5.5 │
|
422
|
+
# # └─────┴─────┘
|
423
|
+
#
|
424
|
+
# @example Match all columns *except* for those given:
|
425
|
+
# df.select(~Polars.cs.by_name("foo", "bar"))
|
426
|
+
# # =>
|
427
|
+
# # shape: (2, 2)
|
428
|
+
# # ┌─────┬───────┐
|
429
|
+
# # │ baz ┆ zap │
|
430
|
+
# # │ --- ┆ --- │
|
431
|
+
# # │ f64 ┆ bool │
|
432
|
+
# # ╞═════╪═══════╡
|
433
|
+
# # │ 2.0 ┆ false │
|
434
|
+
# # │ 5.5 ┆ true │
|
435
|
+
# # └─────┴───────┘
|
436
|
+
def self.by_name(*names, require_all: true)
|
437
|
+
all_names = []
|
438
|
+
names.each do |nm|
|
439
|
+
if nm.is_a?(::String)
|
440
|
+
all_names << nm
|
441
|
+
else
|
442
|
+
msg = "invalid name: #{nm.inspect}"
|
443
|
+
raise TypeError, msg
|
444
|
+
end
|
445
|
+
end
|
446
|
+
|
447
|
+
selector_params = {"*names" => all_names}
|
448
|
+
match_cols = all_names
|
449
|
+
if !require_all
|
450
|
+
match_cols = "^(#{all_names.map { |nm| Utils.re_escape(nm) }.join("|")})$"
|
451
|
+
selector_params["require_all"] = require_all
|
452
|
+
end
|
453
|
+
|
454
|
+
_selector_proxy_(
|
455
|
+
F.col(match_cols),
|
456
|
+
name: "by_name",
|
457
|
+
parameters: selector_params
|
458
|
+
)
|
459
|
+
end
|
378
460
|
|
379
461
|
# Select all categorical columns.
|
380
462
|
#
|
data/lib/polars/version.rb
CHANGED
data/lib/polars.rb
CHANGED
@@ -49,6 +49,7 @@ require_relative "polars/group_by"
|
|
49
49
|
require_relative "polars/io/avro"
|
50
50
|
require_relative "polars/io/csv"
|
51
51
|
require_relative "polars/io/database"
|
52
|
+
require_relative "polars/io/delta"
|
52
53
|
require_relative "polars/io/ipc"
|
53
54
|
require_relative "polars/io/json"
|
54
55
|
require_relative "polars/io/ndjson"
|
@@ -89,4 +90,18 @@ module Polars
|
|
89
90
|
|
90
91
|
# @private
|
91
92
|
N_INFER_DEFAULT = 100
|
93
|
+
|
94
|
+
# @private
|
95
|
+
class ArrowArrayStream
|
96
|
+
def arrow_c_stream
|
97
|
+
self
|
98
|
+
end
|
99
|
+
end
|
100
|
+
|
101
|
+
# Return the number of threads in the Polars thread pool.
|
102
|
+
#
|
103
|
+
# @return [Integer]
|
104
|
+
def self.thread_pool_size
|
105
|
+
Plr.thread_pool_size
|
106
|
+
end
|
92
107
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: polars-df
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.16.0
|
5
5
|
platform: x86_64-linux-musl
|
6
6
|
authors:
|
7
7
|
- Andrew Kane
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2024-
|
11
|
+
date: 2024-12-29 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bigdecimal
|
@@ -24,7 +24,6 @@ dependencies:
|
|
24
24
|
- - ">="
|
25
25
|
- !ruby/object:Gem::Version
|
26
26
|
version: '0'
|
27
|
-
force_ruby_platform: false
|
28
27
|
description:
|
29
28
|
email: andrew@ankane.org
|
30
29
|
executables: []
|
@@ -40,9 +39,9 @@ files:
|
|
40
39
|
- README.md
|
41
40
|
- lib/polars-df.rb
|
42
41
|
- lib/polars.rb
|
43
|
-
- lib/polars/3.1/polars.so
|
44
42
|
- lib/polars/3.2/polars.so
|
45
43
|
- lib/polars/3.3/polars.so
|
44
|
+
- lib/polars/3.4/polars.so
|
46
45
|
- lib/polars/array_expr.rb
|
47
46
|
- lib/polars/array_name_space.rb
|
48
47
|
- lib/polars/batched_csv_reader.rb
|
@@ -80,6 +79,7 @@ files:
|
|
80
79
|
- lib/polars/io/avro.rb
|
81
80
|
- lib/polars/io/csv.rb
|
82
81
|
- lib/polars/io/database.rb
|
82
|
+
- lib/polars/io/delta.rb
|
83
83
|
- lib/polars/io/ipc.rb
|
84
84
|
- lib/polars/io/json.rb
|
85
85
|
- lib/polars/io/ndjson.rb
|
@@ -122,17 +122,17 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
122
122
|
requirements:
|
123
123
|
- - ">="
|
124
124
|
- !ruby/object:Gem::Version
|
125
|
-
version: '3.
|
125
|
+
version: '3.2'
|
126
126
|
- - "<"
|
127
127
|
- !ruby/object:Gem::Version
|
128
|
-
version: 3.
|
128
|
+
version: 3.5.dev
|
129
129
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
130
130
|
requirements:
|
131
131
|
- - ">="
|
132
132
|
- !ruby/object:Gem::Version
|
133
|
-
version:
|
133
|
+
version: '0'
|
134
134
|
requirements: []
|
135
|
-
rubygems_version: 3.
|
135
|
+
rubygems_version: 3.5.23
|
136
136
|
signing_key:
|
137
137
|
specification_version: 4
|
138
138
|
summary: Blazingly fast DataFrames for Ruby
|