polars-df 0.19.0-x86_64-darwin → 0.20.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 +4 -0
- data/Cargo.lock +60 -175
- data/LICENSE-THIRD-PARTY.txt +521 -1017
- data/lib/polars/3.2/polars.bundle +0 -0
- data/lib/polars/3.3/polars.bundle +0 -0
- data/lib/polars/3.4/polars.bundle +0 -0
- data/lib/polars/expr.rb +14 -8
- data/lib/polars/functions/eager.rb +1 -1
- data/lib/polars/list_expr.rb +9 -10
- data/lib/polars/list_name_space.rb +1 -7
- data/lib/polars/meta_expr.rb +7 -7
- data/lib/polars/series.rb +12 -8
- data/lib/polars/string_name_space.rb +1 -1
- data/lib/polars/version.rb +1 -1
- metadata +2 -2
Binary file
|
Binary file
|
Binary file
|
data/lib/polars/expr.rb
CHANGED
@@ -1512,6 +1512,13 @@ module Polars
|
|
1512
1512
|
#
|
1513
1513
|
# @param element [Object]
|
1514
1514
|
# Expression or scalar value.
|
1515
|
+
# @param side ['any', 'left', 'right']
|
1516
|
+
# If 'any', the index of the first suitable location found is given.
|
1517
|
+
# If 'left', the index of the leftmost suitable location found is given.
|
1518
|
+
# If 'right', return the rightmost suitable location found is given.
|
1519
|
+
# @param descending [Boolean]
|
1520
|
+
# Boolean indicating whether the values are descending or not (they
|
1521
|
+
# are required to be sorted either way).
|
1515
1522
|
#
|
1516
1523
|
# @return [Expr]
|
1517
1524
|
#
|
@@ -1537,9 +1544,9 @@ module Polars
|
|
1537
1544
|
# # ╞══════╪═══════╪═════╡
|
1538
1545
|
# # │ 0 ┆ 2 ┆ 4 │
|
1539
1546
|
# # └──────┴───────┴─────┘
|
1540
|
-
def search_sorted(element, side: "any")
|
1547
|
+
def search_sorted(element, side: "any", descending: false)
|
1541
1548
|
element = Utils.parse_into_expression(element, str_as_lit: false)
|
1542
|
-
_from_rbexpr(_rbexpr.search_sorted(element, side))
|
1549
|
+
_from_rbexpr(_rbexpr.search_sorted(element, side, descending))
|
1543
1550
|
end
|
1544
1551
|
|
1545
1552
|
# Sort this column by the ordering of another column, or multiple other columns.
|
@@ -6651,6 +6658,8 @@ module Polars
|
|
6651
6658
|
# # │ 99 │
|
6652
6659
|
# # └────────┘
|
6653
6660
|
def extend_constant(value, n)
|
6661
|
+
value = Utils.parse_into_expression(value, str_as_lit: true)
|
6662
|
+
n = Utils.parse_into_expression(n)
|
6654
6663
|
_from_rbexpr(_rbexpr.extend_constant(value, n))
|
6655
6664
|
end
|
6656
6665
|
|
@@ -6814,9 +6823,6 @@ module Polars
|
|
6814
6823
|
# @param min_periods [Integer]
|
6815
6824
|
# Number of valid values there should be in the window before the expression
|
6816
6825
|
# is evaluated. valid values = `length - null_count`
|
6817
|
-
# @param parallel [Boolean]
|
6818
|
-
# Run in parallel. Don't do this in a group by or another operation that
|
6819
|
-
# already has much parallelization.
|
6820
6826
|
#
|
6821
6827
|
# @return [Expr]
|
6822
6828
|
#
|
@@ -6850,9 +6856,9 @@ module Polars
|
|
6850
6856
|
# # │ -15 │
|
6851
6857
|
# # │ -24 │
|
6852
6858
|
# # └────────┘
|
6853
|
-
def cumulative_eval(expr, min_periods: 1
|
6859
|
+
def cumulative_eval(expr, min_periods: 1)
|
6854
6860
|
_from_rbexpr(
|
6855
|
-
_rbexpr.cumulative_eval(expr._rbexpr, min_periods
|
6861
|
+
_rbexpr.cumulative_eval(expr._rbexpr, min_periods)
|
6856
6862
|
)
|
6857
6863
|
end
|
6858
6864
|
|
@@ -7117,7 +7123,7 @@ module Polars
|
|
7117
7123
|
# Accepts expression input. Sequences are parsed as Series,
|
7118
7124
|
# other non-expression inputs are parsed as literals.
|
7119
7125
|
# Also accepts a mapping of values to their replacement as syntactic sugar for
|
7120
|
-
# `replace_all(old: Series.new(mapping.keys), new:
|
7126
|
+
# `replace_all(old: Series.new(mapping.keys), new: Series.new(mapping.values))`.
|
7121
7127
|
# @param new [Object]
|
7122
7128
|
# Value or sequence of values to replace by.
|
7123
7129
|
# Accepts expression input. Sequences are parsed as Series,
|
@@ -206,7 +206,7 @@ module Polars
|
|
206
206
|
end
|
207
207
|
end
|
208
208
|
|
209
|
-
# Align a sequence of frames using the
|
209
|
+
# Align a sequence of frames using the unique values from one or more columns as a key.
|
210
210
|
#
|
211
211
|
# Frames that do not contain the given key values have rows injected (with nulls
|
212
212
|
# filling the non-key columns), and each resulting frame is sorted by the key.
|
data/lib/polars/list_expr.rb
CHANGED
@@ -245,6 +245,11 @@ module Polars
|
|
245
245
|
|
246
246
|
# Sort the arrays in the list.
|
247
247
|
#
|
248
|
+
# @param reverse [Boolean]
|
249
|
+
# Sort in descending order.
|
250
|
+
# @param nulls_last [Boolean]
|
251
|
+
# Place null values last.
|
252
|
+
#
|
248
253
|
# @return [Expr]
|
249
254
|
#
|
250
255
|
# @example
|
@@ -264,8 +269,8 @@ module Polars
|
|
264
269
|
# # │ [1, 2, 3] │
|
265
270
|
# # │ [1, 2, 9] │
|
266
271
|
# # └───────────┘
|
267
|
-
def sort(reverse: false)
|
268
|
-
Utils.wrap_expr(_rbexpr.list_sort(reverse))
|
272
|
+
def sort(reverse: false, nulls_last: false)
|
273
|
+
Utils.wrap_expr(_rbexpr.list_sort(reverse, nulls_last))
|
269
274
|
end
|
270
275
|
|
271
276
|
# Reverse the arrays in the list.
|
@@ -758,12 +763,6 @@ module Polars
|
|
758
763
|
# @param expr [Expr]
|
759
764
|
# Expression to run. Note that you can select an element with `Polars.first`, or
|
760
765
|
# `Polars.col`
|
761
|
-
# @param parallel [Boolean]
|
762
|
-
# Run all expression parallel. Don't activate this blindly.
|
763
|
-
# Parallelism is worth it if there is enough work to do per thread.
|
764
|
-
#
|
765
|
-
# This likely should not be use in the group by context, because we already
|
766
|
-
# parallel execution per group
|
767
766
|
#
|
768
767
|
# @return [Expr]
|
769
768
|
#
|
@@ -783,8 +782,8 @@ module Polars
|
|
783
782
|
# # │ 8 ┆ 5 ┆ [2.0, 1.0] │
|
784
783
|
# # │ 3 ┆ 2 ┆ [2.0, 1.0] │
|
785
784
|
# # └─────┴─────┴────────────┘
|
786
|
-
def eval(expr
|
787
|
-
Utils.wrap_expr(_rbexpr.list_eval(expr._rbexpr
|
785
|
+
def eval(expr)
|
786
|
+
Utils.wrap_expr(_rbexpr.list_eval(expr._rbexpr))
|
788
787
|
end
|
789
788
|
end
|
790
789
|
end
|
@@ -586,12 +586,6 @@ module Polars
|
|
586
586
|
# @param expr [Expr]
|
587
587
|
# Expression to run. Note that you can select an element with `Polars.first`, or
|
588
588
|
# `Polars.col`
|
589
|
-
# @param parallel [Boolean]
|
590
|
-
# Run all expression parallel. Don't activate this blindly.
|
591
|
-
# Parallelism is worth it if there is enough work to do per thread.
|
592
|
-
#
|
593
|
-
# This likely should not be use in the group by context, because we already
|
594
|
-
# parallel execution per group
|
595
589
|
#
|
596
590
|
# @return [Series]
|
597
591
|
#
|
@@ -611,7 +605,7 @@ module Polars
|
|
611
605
|
# # │ 8 ┆ 5 ┆ [2.0, 1.0] │
|
612
606
|
# # │ 3 ┆ 2 ┆ [2.0, 1.0] │
|
613
607
|
# # └─────┴─────┴────────────┘
|
614
|
-
def eval(expr
|
608
|
+
def eval(expr)
|
615
609
|
super
|
616
610
|
end
|
617
611
|
end
|
data/lib/polars/meta_expr.rb
CHANGED
@@ -125,14 +125,14 @@ module Polars
|
|
125
125
|
# @return [Array]
|
126
126
|
#
|
127
127
|
# @example
|
128
|
-
# e = Polars.col("foo").
|
128
|
+
# e = Polars.col("foo") + Polars.col("bar")
|
129
129
|
# first = e.meta.pop[0]
|
130
|
-
# _ = first.meta == Polars.col("foo")
|
131
|
-
# # => true
|
132
130
|
# _ = first.meta == Polars.col("bar")
|
131
|
+
# # => true
|
132
|
+
# _ = first.meta == Polars.col("foo")
|
133
133
|
# # => false
|
134
|
-
def pop
|
135
|
-
_rbexpr.meta_pop.map { |e| Utils.wrap_expr(e) }
|
134
|
+
def pop(schema: nil)
|
135
|
+
_rbexpr.meta_pop(schema).map { |e| Utils.wrap_expr(e) }
|
136
136
|
end
|
137
137
|
|
138
138
|
# Get a list with the root column name.
|
@@ -209,8 +209,8 @@ module Polars
|
|
209
209
|
# @example
|
210
210
|
# e = (Polars.col("foo") * Polars.col("bar")).sum.over(Polars.col("ham")) / 2
|
211
211
|
# e.meta.tree_format(return_as_string: true)
|
212
|
-
def tree_format(return_as_string: false)
|
213
|
-
s = _rbexpr.meta_tree_format
|
212
|
+
def tree_format(return_as_string: false, schema: nil)
|
213
|
+
s = _rbexpr.meta_tree_format(schema)
|
214
214
|
if return_as_string
|
215
215
|
s
|
216
216
|
else
|
data/lib/polars/series.rb
CHANGED
@@ -1321,9 +1321,6 @@ module Polars
|
|
1321
1321
|
# @param min_periods [Integer]
|
1322
1322
|
# Number of valid values there should be in the window before the expression
|
1323
1323
|
# is evaluated. valid values = `length - null_count`
|
1324
|
-
# @param parallel [Boolean]
|
1325
|
-
# Run in parallel. Don't do this in a group by or another operation that
|
1326
|
-
# already has much parallelization.
|
1327
1324
|
#
|
1328
1325
|
# @return [Series]
|
1329
1326
|
#
|
@@ -1348,7 +1345,7 @@ module Polars
|
|
1348
1345
|
# # -15
|
1349
1346
|
# # -24
|
1350
1347
|
# # ]
|
1351
|
-
def cumulative_eval(expr, min_periods: 1
|
1348
|
+
def cumulative_eval(expr, min_periods: 1)
|
1352
1349
|
super
|
1353
1350
|
end
|
1354
1351
|
|
@@ -1879,6 +1876,13 @@ module Polars
|
|
1879
1876
|
#
|
1880
1877
|
# @param element [Object]
|
1881
1878
|
# Expression or scalar value.
|
1879
|
+
# @param side ['any', 'left', 'right']
|
1880
|
+
# If 'any', the index of the first suitable location found is given.
|
1881
|
+
# If 'left', the index of the leftmost suitable location found is given.
|
1882
|
+
# If 'right', return the rightmost suitable location found is given.
|
1883
|
+
# @param descending [Boolean]
|
1884
|
+
# Boolean indicating whether the values are descending or not (they
|
1885
|
+
# are required to be sorted either way).
|
1882
1886
|
#
|
1883
1887
|
# @return [Integer]
|
1884
1888
|
#
|
@@ -1927,12 +1931,12 @@ module Polars
|
|
1927
1931
|
# # 5
|
1928
1932
|
# # 6
|
1929
1933
|
# # ]
|
1930
|
-
def search_sorted(element, side: "any")
|
1934
|
+
def search_sorted(element, side: "any", descending: false)
|
1931
1935
|
if element.is_a?(Integer) || element.is_a?(Float)
|
1932
|
-
return Polars.select(Polars.lit(self).search_sorted(element, side: side)).item
|
1936
|
+
return Polars.select(Polars.lit(self).search_sorted(element, side: side, descending: descending)).item
|
1933
1937
|
end
|
1934
1938
|
element = Series.new(element)
|
1935
|
-
Polars.select(Polars.lit(self).search_sorted(element, side: side)).to_series
|
1939
|
+
Polars.select(Polars.lit(self).search_sorted(element, side: side, descending: descending)).to_series
|
1936
1940
|
end
|
1937
1941
|
|
1938
1942
|
# Get unique elements in series.
|
@@ -4366,7 +4370,7 @@ module Polars
|
|
4366
4370
|
# # 99
|
4367
4371
|
# # ]
|
4368
4372
|
def extend_constant(value, n)
|
4369
|
-
|
4373
|
+
super
|
4370
4374
|
end
|
4371
4375
|
|
4372
4376
|
# Flags the Series as sorted.
|
@@ -120,7 +120,7 @@ module Polars
|
|
120
120
|
# Parse a Series of dtype Utf8 to a Date/Datetime Series.
|
121
121
|
#
|
122
122
|
# @param datatype [Symbol]
|
123
|
-
# `:date`, `:
|
123
|
+
# `:date`, `:datetime`, or `:time`.
|
124
124
|
# @param fmt [String]
|
125
125
|
# Format to use, refer to the
|
126
126
|
# [chrono strftime documentation](https://docs.rs/chrono/latest/chrono/format/strftime/index.html)
|
data/lib/polars/version.rb
CHANGED
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.20.0
|
5
5
|
platform: x86_64-darwin
|
6
6
|
authors:
|
7
7
|
- Andrew Kane
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2025-
|
11
|
+
date: 2025-06-24 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bigdecimal
|