polars-df 0.13.0-x64-mingw-ucrt
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.yardopts +3 -0
- data/CHANGELOG.md +208 -0
- data/Cargo.lock +2556 -0
- data/Cargo.toml +6 -0
- data/LICENSE-THIRD-PARTY.txt +39278 -0
- data/LICENSE.txt +20 -0
- data/README.md +437 -0
- data/lib/polars/3.1/polars.so +0 -0
- data/lib/polars/3.2/polars.so +0 -0
- data/lib/polars/3.3/polars.so +0 -0
- data/lib/polars/array_expr.rb +537 -0
- data/lib/polars/array_name_space.rb +423 -0
- data/lib/polars/batched_csv_reader.rb +104 -0
- data/lib/polars/binary_expr.rb +77 -0
- data/lib/polars/binary_name_space.rb +66 -0
- data/lib/polars/cat_expr.rb +36 -0
- data/lib/polars/cat_name_space.rb +88 -0
- data/lib/polars/config.rb +530 -0
- data/lib/polars/convert.rb +98 -0
- data/lib/polars/data_frame.rb +5191 -0
- data/lib/polars/data_types.rb +466 -0
- data/lib/polars/date_time_expr.rb +1397 -0
- data/lib/polars/date_time_name_space.rb +1287 -0
- data/lib/polars/dynamic_group_by.rb +52 -0
- data/lib/polars/exceptions.rb +38 -0
- data/lib/polars/expr.rb +7256 -0
- data/lib/polars/expr_dispatch.rb +22 -0
- 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 +271 -0
- data/lib/polars/functions/col.rb +47 -0
- data/lib/polars/functions/eager.rb +182 -0
- data/lib/polars/functions/lazy.rb +1329 -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 +136 -0
- data/lib/polars/functions/range/datetime_range.rb +149 -0
- data/lib/polars/functions/range/int_range.rb +51 -0
- data/lib/polars/functions/range/time_range.rb +141 -0
- data/lib/polars/functions/repeat.rb +144 -0
- data/lib/polars/functions/whenthen.rb +96 -0
- data/lib/polars/functions.rb +57 -0
- data/lib/polars/group_by.rb +613 -0
- data/lib/polars/io/avro.rb +24 -0
- data/lib/polars/io/csv.rb +696 -0
- data/lib/polars/io/database.rb +73 -0
- data/lib/polars/io/ipc.rb +275 -0
- data/lib/polars/io/json.rb +29 -0
- data/lib/polars/io/ndjson.rb +80 -0
- data/lib/polars/io/parquet.rb +233 -0
- data/lib/polars/lazy_frame.rb +2708 -0
- data/lib/polars/lazy_group_by.rb +181 -0
- data/lib/polars/list_expr.rb +791 -0
- data/lib/polars/list_name_space.rb +449 -0
- data/lib/polars/meta_expr.rb +222 -0
- data/lib/polars/name_expr.rb +198 -0
- data/lib/polars/plot.rb +109 -0
- data/lib/polars/rolling_group_by.rb +35 -0
- data/lib/polars/series.rb +4444 -0
- data/lib/polars/slice.rb +104 -0
- data/lib/polars/sql_context.rb +194 -0
- data/lib/polars/string_cache.rb +75 -0
- data/lib/polars/string_expr.rb +1495 -0
- data/lib/polars/string_name_space.rb +811 -0
- data/lib/polars/struct_expr.rb +98 -0
- data/lib/polars/struct_name_space.rb +96 -0
- data/lib/polars/testing.rb +507 -0
- data/lib/polars/utils/constants.rb +9 -0
- data/lib/polars/utils/convert.rb +97 -0
- data/lib/polars/utils/parse.rb +89 -0
- data/lib/polars/utils/various.rb +76 -0
- data/lib/polars/utils/wrap.rb +19 -0
- data/lib/polars/utils.rb +130 -0
- data/lib/polars/version.rb +4 -0
- data/lib/polars/whenthen.rb +83 -0
- data/lib/polars-df.rb +1 -0
- data/lib/polars.rb +91 -0
- metadata +138 -0
@@ -0,0 +1,52 @@
|
|
1
|
+
module Polars
|
2
|
+
# A dynamic grouper.
|
3
|
+
#
|
4
|
+
# This has an `.agg` method which allows you to run all polars expressions in a
|
5
|
+
# group by context.
|
6
|
+
class DynamicGroupBy
|
7
|
+
def initialize(
|
8
|
+
df,
|
9
|
+
index_column,
|
10
|
+
every,
|
11
|
+
period,
|
12
|
+
offset,
|
13
|
+
truncate,
|
14
|
+
include_boundaries,
|
15
|
+
closed,
|
16
|
+
by,
|
17
|
+
start_by
|
18
|
+
)
|
19
|
+
period = Utils.parse_as_duration_string(period)
|
20
|
+
offset = Utils.parse_as_duration_string(offset)
|
21
|
+
every = Utils.parse_as_duration_string(every)
|
22
|
+
|
23
|
+
@df = df
|
24
|
+
@time_column = index_column
|
25
|
+
@every = every
|
26
|
+
@period = period
|
27
|
+
@offset = offset
|
28
|
+
@truncate = truncate
|
29
|
+
@include_boundaries = include_boundaries
|
30
|
+
@closed = closed
|
31
|
+
@by = by
|
32
|
+
@start_by = start_by
|
33
|
+
end
|
34
|
+
|
35
|
+
def agg(*aggs, **named_aggs)
|
36
|
+
@df.lazy
|
37
|
+
.group_by_dynamic(
|
38
|
+
@time_column,
|
39
|
+
every: @every,
|
40
|
+
period: @period,
|
41
|
+
offset: @offset,
|
42
|
+
truncate: @truncate,
|
43
|
+
include_boundaries: @include_boundaries,
|
44
|
+
closed: @closed,
|
45
|
+
by: @by,
|
46
|
+
start_by: @start_by
|
47
|
+
)
|
48
|
+
.agg(*aggs, **named_aggs)
|
49
|
+
.collect(no_optimization: true, string_cache: false)
|
50
|
+
end
|
51
|
+
end
|
52
|
+
end
|
@@ -0,0 +1,38 @@
|
|
1
|
+
module Polars
|
2
|
+
# @private
|
3
|
+
# Base class for all Polars errors.
|
4
|
+
class Error < StandardError; end
|
5
|
+
|
6
|
+
# @private
|
7
|
+
# Exception raised when an operation is not allowed (or possible) against a given object or data structure.
|
8
|
+
class InvalidOperationError < Error; end
|
9
|
+
|
10
|
+
# @private
|
11
|
+
# Exception raised when an unsupported testing assert is made.
|
12
|
+
class InvalidAssert < Error; end
|
13
|
+
|
14
|
+
# @private
|
15
|
+
# Exception raised when the number of returned rows does not match expectation.
|
16
|
+
class RowsException < Error; end
|
17
|
+
|
18
|
+
# @private
|
19
|
+
# Exception raised when no rows are returned, but at least one row is expected.
|
20
|
+
class NoRowsReturned < RowsException; end
|
21
|
+
|
22
|
+
# @private
|
23
|
+
# Exception raised when more rows than expected are returned.
|
24
|
+
class TooManyRowsReturned < RowsException; end
|
25
|
+
|
26
|
+
# @private
|
27
|
+
class AssertionError < Error; end
|
28
|
+
|
29
|
+
# @private
|
30
|
+
class ComputeError < Error; end
|
31
|
+
|
32
|
+
# @private
|
33
|
+
class Todo < Error
|
34
|
+
def message
|
35
|
+
"not implemented yet"
|
36
|
+
end
|
37
|
+
end
|
38
|
+
end
|