polars-df 0.8.0-arm64-darwin → 0.10.0-arm64-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 +42 -1
- data/Cargo.lock +159 -66
- data/Cargo.toml +0 -3
- data/LICENSE-THIRD-PARTY.txt +3112 -1613
- data/LICENSE.txt +1 -1
- data/README.md +3 -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/array_expr.rb +453 -0
- data/lib/polars/array_name_space.rb +346 -0
- data/lib/polars/batched_csv_reader.rb +4 -2
- data/lib/polars/cat_expr.rb +24 -0
- data/lib/polars/cat_name_space.rb +75 -0
- data/lib/polars/config.rb +2 -2
- data/lib/polars/data_frame.rb +306 -96
- data/lib/polars/data_types.rb +191 -28
- data/lib/polars/date_time_expr.rb +41 -18
- data/lib/polars/date_time_name_space.rb +9 -3
- data/lib/polars/exceptions.rb +12 -1
- data/lib/polars/expr.rb +898 -215
- data/lib/polars/functions/aggregation/horizontal.rb +246 -0
- data/lib/polars/functions/aggregation/vertical.rb +282 -0
- data/lib/polars/functions/as_datatype.rb +248 -0
- data/lib/polars/functions/col.rb +47 -0
- data/lib/polars/functions/eager.rb +182 -0
- data/lib/polars/functions/lazy.rb +1280 -0
- data/lib/polars/functions/len.rb +49 -0
- data/lib/polars/functions/lit.rb +35 -0
- data/lib/polars/functions/random.rb +16 -0
- data/lib/polars/functions/range/date_range.rb +103 -0
- data/lib/polars/functions/range/int_range.rb +51 -0
- data/lib/polars/functions/repeat.rb +144 -0
- data/lib/polars/functions/whenthen.rb +96 -0
- data/lib/polars/functions.rb +29 -416
- data/lib/polars/group_by.rb +2 -2
- data/lib/polars/io.rb +36 -31
- data/lib/polars/lazy_frame.rb +405 -88
- data/lib/polars/list_expr.rb +158 -8
- data/lib/polars/list_name_space.rb +102 -0
- data/lib/polars/meta_expr.rb +175 -7
- data/lib/polars/series.rb +282 -41
- data/lib/polars/string_cache.rb +75 -0
- data/lib/polars/string_expr.rb +413 -96
- data/lib/polars/string_name_space.rb +4 -4
- data/lib/polars/testing.rb +507 -0
- data/lib/polars/utils.rb +106 -8
- data/lib/polars/version.rb +1 -1
- data/lib/polars/whenthen.rb +83 -0
- data/lib/polars.rb +16 -4
- metadata +34 -6
- data/lib/polars/lazy_functions.rb +0 -1181
- data/lib/polars/when.rb +0 -16
- data/lib/polars/when_then.rb +0 -19
@@ -0,0 +1,83 @@
|
|
1
|
+
module Polars
|
2
|
+
# @private
|
3
|
+
class When
|
4
|
+
attr_accessor :_when
|
5
|
+
|
6
|
+
def initialize(rbwhen)
|
7
|
+
self._when = rbwhen
|
8
|
+
end
|
9
|
+
|
10
|
+
def then(statement)
|
11
|
+
statement_rbexpr = Utils.parse_as_expression(statement)
|
12
|
+
Then.new(_when.then(statement_rbexpr))
|
13
|
+
end
|
14
|
+
end
|
15
|
+
|
16
|
+
# @private
|
17
|
+
class Then < Expr
|
18
|
+
attr_accessor :_then
|
19
|
+
|
20
|
+
def initialize(rbthen)
|
21
|
+
self._then = rbthen
|
22
|
+
end
|
23
|
+
|
24
|
+
def self._from_rbexpr(rbexpr)
|
25
|
+
Utils.wrap_expr(rbexpr)
|
26
|
+
end
|
27
|
+
|
28
|
+
def _rbexpr
|
29
|
+
_then.otherwise(Polars.lit(nil)._rbexpr)
|
30
|
+
end
|
31
|
+
|
32
|
+
def when(*predicates, **constraints)
|
33
|
+
condition_rbexpr = Utils.parse_when_inputs(*predicates, **constraints)
|
34
|
+
ChainedWhen.new(_then.when(condition_rbexpr))
|
35
|
+
end
|
36
|
+
|
37
|
+
def otherwise(statement)
|
38
|
+
statement_rbexpr = Utils.parse_as_expression(statement)
|
39
|
+
Utils.wrap_expr(_then.otherwise(statement_rbexpr))
|
40
|
+
end
|
41
|
+
end
|
42
|
+
|
43
|
+
# @private
|
44
|
+
class ChainedWhen
|
45
|
+
attr_accessor :_chained_when
|
46
|
+
|
47
|
+
def initialize(chained_when)
|
48
|
+
self._chained_when = chained_when
|
49
|
+
end
|
50
|
+
|
51
|
+
def then(statement)
|
52
|
+
statement_rbexpr = Utils.parse_as_expression(statement)
|
53
|
+
ChainedThen.new(_chained_when.then(statement_rbexpr))
|
54
|
+
end
|
55
|
+
end
|
56
|
+
|
57
|
+
# @private
|
58
|
+
class ChainedThen < Expr
|
59
|
+
attr_accessor :_chained_then
|
60
|
+
|
61
|
+
def initialize(chained_then)
|
62
|
+
self._chained_then = chained_then
|
63
|
+
end
|
64
|
+
|
65
|
+
def self._from_rbexpr(rbexpr)
|
66
|
+
Utils.wrap_expr(rbexpr)
|
67
|
+
end
|
68
|
+
|
69
|
+
def _rbexpr
|
70
|
+
_chained_then.otherwise(Polars.lit(nil)._rbexpr)
|
71
|
+
end
|
72
|
+
|
73
|
+
def when(*predicates, **constraints)
|
74
|
+
condition_rbexpr = Utils.parse_when_inputs(*predicates, **constraints)
|
75
|
+
ChainedWhen.new(_chained_then.when(condition_rbexpr))
|
76
|
+
end
|
77
|
+
|
78
|
+
def otherwise(statement)
|
79
|
+
statement_rbexpr = Utils.parse_as_expression(statement)
|
80
|
+
Utils.wrap_expr(_chained_then.otherwise(statement_rbexpr))
|
81
|
+
end
|
82
|
+
end
|
83
|
+
end
|
data/lib/polars.rb
CHANGED
@@ -30,10 +30,22 @@ require_relative "polars/dynamic_group_by"
|
|
30
30
|
require_relative "polars/exceptions"
|
31
31
|
require_relative "polars/expr"
|
32
32
|
require_relative "polars/functions"
|
33
|
+
require_relative "polars/functions/as_datatype"
|
34
|
+
require_relative "polars/functions/col"
|
35
|
+
require_relative "polars/functions/eager"
|
36
|
+
require_relative "polars/functions/lazy"
|
37
|
+
require_relative "polars/functions/len"
|
38
|
+
require_relative "polars/functions/lit"
|
39
|
+
require_relative "polars/functions/random"
|
40
|
+
require_relative "polars/functions/repeat"
|
41
|
+
require_relative "polars/functions/whenthen"
|
42
|
+
require_relative "polars/functions/aggregation/horizontal"
|
43
|
+
require_relative "polars/functions/aggregation/vertical"
|
44
|
+
require_relative "polars/functions/range/date_range"
|
45
|
+
require_relative "polars/functions/range/int_range"
|
33
46
|
require_relative "polars/group_by"
|
34
47
|
require_relative "polars/io"
|
35
48
|
require_relative "polars/lazy_frame"
|
36
|
-
require_relative "polars/lazy_functions"
|
37
49
|
require_relative "polars/lazy_group_by"
|
38
50
|
require_relative "polars/list_expr"
|
39
51
|
require_relative "polars/list_name_space"
|
@@ -43,18 +55,18 @@ require_relative "polars/rolling_group_by"
|
|
43
55
|
require_relative "polars/series"
|
44
56
|
require_relative "polars/slice"
|
45
57
|
require_relative "polars/sql_context"
|
58
|
+
require_relative "polars/string_cache"
|
46
59
|
require_relative "polars/string_expr"
|
47
60
|
require_relative "polars/string_name_space"
|
48
61
|
require_relative "polars/struct_expr"
|
49
62
|
require_relative "polars/struct_name_space"
|
63
|
+
require_relative "polars/testing"
|
50
64
|
require_relative "polars/utils"
|
51
65
|
require_relative "polars/version"
|
52
|
-
require_relative "polars/
|
53
|
-
require_relative "polars/when_then"
|
66
|
+
require_relative "polars/whenthen"
|
54
67
|
|
55
68
|
module Polars
|
56
69
|
extend Convert
|
57
70
|
extend Functions
|
58
71
|
extend IO
|
59
|
-
extend LazyFunctions
|
60
72
|
end
|
metadata
CHANGED
@@ -1,15 +1,30 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: polars-df
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.10.0
|
5
5
|
platform: arm64-darwin
|
6
6
|
authors:
|
7
7
|
- Andrew Kane
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2024-
|
12
|
-
dependencies:
|
11
|
+
date: 2024-05-03 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: bigdecimal
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - ">="
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '0'
|
20
|
+
type: :runtime
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - ">="
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '0'
|
27
|
+
force_ruby_platform: false
|
13
28
|
description:
|
14
29
|
email: andrew@ankane.org
|
15
30
|
executables: []
|
@@ -46,10 +61,22 @@ files:
|
|
46
61
|
- lib/polars/expr.rb
|
47
62
|
- lib/polars/expr_dispatch.rb
|
48
63
|
- lib/polars/functions.rb
|
64
|
+
- lib/polars/functions/aggregation/horizontal.rb
|
65
|
+
- lib/polars/functions/aggregation/vertical.rb
|
66
|
+
- lib/polars/functions/as_datatype.rb
|
67
|
+
- lib/polars/functions/col.rb
|
68
|
+
- lib/polars/functions/eager.rb
|
69
|
+
- lib/polars/functions/lazy.rb
|
70
|
+
- lib/polars/functions/len.rb
|
71
|
+
- lib/polars/functions/lit.rb
|
72
|
+
- lib/polars/functions/random.rb
|
73
|
+
- lib/polars/functions/range/date_range.rb
|
74
|
+
- lib/polars/functions/range/int_range.rb
|
75
|
+
- lib/polars/functions/repeat.rb
|
76
|
+
- lib/polars/functions/whenthen.rb
|
49
77
|
- lib/polars/group_by.rb
|
50
78
|
- lib/polars/io.rb
|
51
79
|
- lib/polars/lazy_frame.rb
|
52
|
-
- lib/polars/lazy_functions.rb
|
53
80
|
- lib/polars/lazy_group_by.rb
|
54
81
|
- lib/polars/list_expr.rb
|
55
82
|
- lib/polars/list_name_space.rb
|
@@ -60,14 +87,15 @@ files:
|
|
60
87
|
- lib/polars/series.rb
|
61
88
|
- lib/polars/slice.rb
|
62
89
|
- lib/polars/sql_context.rb
|
90
|
+
- lib/polars/string_cache.rb
|
63
91
|
- lib/polars/string_expr.rb
|
64
92
|
- lib/polars/string_name_space.rb
|
65
93
|
- lib/polars/struct_expr.rb
|
66
94
|
- lib/polars/struct_name_space.rb
|
95
|
+
- lib/polars/testing.rb
|
67
96
|
- lib/polars/utils.rb
|
68
97
|
- lib/polars/version.rb
|
69
|
-
- lib/polars/
|
70
|
-
- lib/polars/when_then.rb
|
98
|
+
- lib/polars/whenthen.rb
|
71
99
|
homepage: https://github.com/ankane/polars-ruby
|
72
100
|
licenses:
|
73
101
|
- MIT
|