polars-df 0.7.0-x86_64-linux → 0.9.0-x86_64-linux

Sign up to get free protection for your applications and to get access to all the features.
Files changed (54) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +41 -0
  3. data/Cargo.lock +353 -237
  4. data/Cargo.toml +0 -3
  5. data/LICENSE-THIRD-PARTY.txt +1978 -1459
  6. data/LICENSE.txt +1 -1
  7. data/README.md +2 -2
  8. data/lib/polars/3.1/polars.so +0 -0
  9. data/lib/polars/3.2/polars.so +0 -0
  10. data/lib/polars/{3.0 → 3.3}/polars.so +0 -0
  11. data/lib/polars/array_expr.rb +449 -0
  12. data/lib/polars/array_name_space.rb +346 -0
  13. data/lib/polars/cat_expr.rb +24 -0
  14. data/lib/polars/cat_name_space.rb +75 -0
  15. data/lib/polars/config.rb +2 -2
  16. data/lib/polars/data_frame.rb +248 -108
  17. data/lib/polars/data_types.rb +195 -29
  18. data/lib/polars/date_time_expr.rb +41 -24
  19. data/lib/polars/date_time_name_space.rb +12 -12
  20. data/lib/polars/exceptions.rb +12 -1
  21. data/lib/polars/expr.rb +1080 -195
  22. data/lib/polars/functions/aggregation/horizontal.rb +246 -0
  23. data/lib/polars/functions/aggregation/vertical.rb +282 -0
  24. data/lib/polars/functions/as_datatype.rb +248 -0
  25. data/lib/polars/functions/col.rb +47 -0
  26. data/lib/polars/functions/eager.rb +182 -0
  27. data/lib/polars/functions/lazy.rb +1280 -0
  28. data/lib/polars/functions/len.rb +49 -0
  29. data/lib/polars/functions/lit.rb +35 -0
  30. data/lib/polars/functions/random.rb +16 -0
  31. data/lib/polars/functions/range/date_range.rb +103 -0
  32. data/lib/polars/functions/range/int_range.rb +51 -0
  33. data/lib/polars/functions/repeat.rb +144 -0
  34. data/lib/polars/functions/whenthen.rb +27 -0
  35. data/lib/polars/functions.rb +29 -416
  36. data/lib/polars/group_by.rb +3 -3
  37. data/lib/polars/io.rb +21 -28
  38. data/lib/polars/lazy_frame.rb +390 -76
  39. data/lib/polars/list_expr.rb +152 -6
  40. data/lib/polars/list_name_space.rb +102 -0
  41. data/lib/polars/meta_expr.rb +175 -7
  42. data/lib/polars/series.rb +557 -59
  43. data/lib/polars/sql_context.rb +1 -1
  44. data/lib/polars/string_cache.rb +75 -0
  45. data/lib/polars/string_expr.rb +412 -96
  46. data/lib/polars/string_name_space.rb +4 -4
  47. data/lib/polars/struct_expr.rb +1 -1
  48. data/lib/polars/struct_name_space.rb +1 -1
  49. data/lib/polars/testing.rb +507 -0
  50. data/lib/polars/utils.rb +64 -20
  51. data/lib/polars/version.rb +1 -1
  52. data/lib/polars.rb +15 -2
  53. metadata +36 -7
  54. data/lib/polars/lazy_functions.rb +0 -1197
@@ -157,7 +157,7 @@ module Polars
157
157
  # ctx.unregister(["test1", "test3"]).tables
158
158
  # # => ["test2"]
159
159
  def unregister(names)
160
- if names.is_a?(String)
160
+ if names.is_a?(::String)
161
161
  names = [names]
162
162
  end
163
163
  names.each do |nm|
@@ -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