polars-df 0.7.0-x86_64-darwin → 0.9.0-x86_64-darwin
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/CHANGELOG.md +41 -0
- data/Cargo.lock +353 -237
- data/Cargo.toml +0 -3
- data/LICENSE-THIRD-PARTY.txt +4014 -3495
- data/LICENSE.txt +1 -1
- data/README.md +2 -2
- data/lib/polars/3.1/polars.bundle +0 -0
- data/lib/polars/3.2/polars.bundle +0 -0
- data/lib/polars/{3.0 → 3.3}/polars.bundle +0 -0
- data/lib/polars/array_expr.rb +449 -0
- data/lib/polars/array_name_space.rb +346 -0
- 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 +248 -108
- data/lib/polars/data_types.rb +195 -29
- data/lib/polars/date_time_expr.rb +41 -24
- data/lib/polars/date_time_name_space.rb +12 -12
- data/lib/polars/exceptions.rb +12 -1
- data/lib/polars/expr.rb +1080 -195
- 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 +27 -0
- data/lib/polars/functions.rb +29 -416
- data/lib/polars/group_by.rb +3 -3
- data/lib/polars/io.rb +21 -28
- data/lib/polars/lazy_frame.rb +390 -76
- data/lib/polars/list_expr.rb +152 -6
- data/lib/polars/list_name_space.rb +102 -0
- data/lib/polars/meta_expr.rb +175 -7
- data/lib/polars/series.rb +557 -59
- data/lib/polars/sql_context.rb +1 -1
- data/lib/polars/string_cache.rb +75 -0
- data/lib/polars/string_expr.rb +412 -96
- data/lib/polars/string_name_space.rb +4 -4
- data/lib/polars/struct_expr.rb +1 -1
- data/lib/polars/struct_name_space.rb +1 -1
- data/lib/polars/testing.rb +507 -0
- data/lib/polars/utils.rb +64 -20
- data/lib/polars/version.rb +1 -1
- data/lib/polars.rb +15 -2
- metadata +36 -7
- data/lib/polars/lazy_functions.rb +0 -1197
data/lib/polars/sql_context.rb
CHANGED
@@ -0,0 +1,75 @@
|
|
1
|
+
module Polars
|
2
|
+
# Context manager for enabling and disabling the global string cache.
|
3
|
+
class StringCache
|
4
|
+
def initialize(&block)
|
5
|
+
RbStringCacheHolder.hold(&block)
|
6
|
+
end
|
7
|
+
end
|
8
|
+
|
9
|
+
module Functions
|
10
|
+
# Enable the global string cache.
|
11
|
+
#
|
12
|
+
# `Categorical` columns created under the same global string cache have
|
13
|
+
# the same underlying physical value when string values are equal. This allows the
|
14
|
+
# columns to be concatenated or used in a join operation, for example.
|
15
|
+
#
|
16
|
+
# @return [nil]
|
17
|
+
#
|
18
|
+
# @example Construct two Series using the same global string cache.
|
19
|
+
# Polars.enable_string_cache
|
20
|
+
# s1 = Polars::Series.new("color", ["red", "green", "red"], dtype: Polars::Categorical)
|
21
|
+
# s2 = Polars::Series.new("color", ["blue", "red", "green"], dtype: Polars::Categorical)
|
22
|
+
# Polars.disable_string_cache
|
23
|
+
#
|
24
|
+
# @example As both Series are constructed under the same global string cache, they can be concatenated.
|
25
|
+
# Polars.concat([s1, s2])
|
26
|
+
# # =>
|
27
|
+
# # shape: (6,)
|
28
|
+
# # Series: 'color' [cat]
|
29
|
+
# # [
|
30
|
+
# # "red"
|
31
|
+
# # "green"
|
32
|
+
# # "red"
|
33
|
+
# # "blue"
|
34
|
+
# # "red"
|
35
|
+
# # "green"
|
36
|
+
# # ]
|
37
|
+
def enable_string_cache
|
38
|
+
Plr.enable_string_cache
|
39
|
+
end
|
40
|
+
|
41
|
+
# Disable and clear the global string cache.
|
42
|
+
#
|
43
|
+
# @return [nil]
|
44
|
+
#
|
45
|
+
# @example Construct two Series using the same global string cache.
|
46
|
+
# Polars.enable_string_cache
|
47
|
+
# s1 = Polars::Series.new("color", ["red", "green", "red"], dtype: Polars::Categorical)
|
48
|
+
# s2 = Polars::Series.new("color", ["blue", "red", "green"], dtype: Polars::Categorical)
|
49
|
+
# Polars.disable_string_cache
|
50
|
+
#
|
51
|
+
# @example As both Series are constructed under the same global string cache, they can be concatenated.
|
52
|
+
# Polars.concat([s1, s2])
|
53
|
+
# # =>
|
54
|
+
# # shape: (6,)
|
55
|
+
# # Series: 'color' [cat]
|
56
|
+
# # [
|
57
|
+
# # "red"
|
58
|
+
# # "green"
|
59
|
+
# # "red"
|
60
|
+
# # "blue"
|
61
|
+
# # "red"
|
62
|
+
# # "green"
|
63
|
+
# # ]
|
64
|
+
def disable_string_cache
|
65
|
+
Plr.disable_string_cache
|
66
|
+
end
|
67
|
+
|
68
|
+
# Check whether the global string cache is enabled.
|
69
|
+
#
|
70
|
+
# @return [Boolean]
|
71
|
+
def using_string_cache
|
72
|
+
Plr.using_string_cache
|
73
|
+
end
|
74
|
+
end
|
75
|
+
end
|