polars-df 0.2.0-arm64-darwin
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 +33 -0
- data/Cargo.lock +2230 -0
- data/Cargo.toml +10 -0
- data/LICENSE-THIRD-PARTY.txt +38856 -0
- data/LICENSE.txt +20 -0
- data/README.md +91 -0
- data/lib/polars/3.0/polars.bundle +0 -0
- data/lib/polars/3.1/polars.bundle +0 -0
- data/lib/polars/3.2/polars.bundle +0 -0
- data/lib/polars/batched_csv_reader.rb +96 -0
- data/lib/polars/cat_expr.rb +52 -0
- data/lib/polars/cat_name_space.rb +54 -0
- data/lib/polars/convert.rb +100 -0
- data/lib/polars/data_frame.rb +4833 -0
- data/lib/polars/data_types.rb +122 -0
- data/lib/polars/date_time_expr.rb +1418 -0
- data/lib/polars/date_time_name_space.rb +1484 -0
- data/lib/polars/dynamic_group_by.rb +52 -0
- data/lib/polars/exceptions.rb +20 -0
- data/lib/polars/expr.rb +5307 -0
- data/lib/polars/expr_dispatch.rb +22 -0
- data/lib/polars/functions.rb +453 -0
- data/lib/polars/group_by.rb +558 -0
- data/lib/polars/io.rb +814 -0
- data/lib/polars/lazy_frame.rb +2442 -0
- data/lib/polars/lazy_functions.rb +1195 -0
- data/lib/polars/lazy_group_by.rb +93 -0
- data/lib/polars/list_expr.rb +610 -0
- data/lib/polars/list_name_space.rb +346 -0
- data/lib/polars/meta_expr.rb +54 -0
- data/lib/polars/rolling_group_by.rb +35 -0
- data/lib/polars/series.rb +3730 -0
- data/lib/polars/slice.rb +104 -0
- data/lib/polars/string_expr.rb +972 -0
- data/lib/polars/string_name_space.rb +690 -0
- data/lib/polars/struct_expr.rb +100 -0
- data/lib/polars/struct_name_space.rb +64 -0
- data/lib/polars/utils.rb +192 -0
- data/lib/polars/version.rb +4 -0
- data/lib/polars/when.rb +16 -0
- data/lib/polars/when_then.rb +19 -0
- data/lib/polars-df.rb +1 -0
- data/lib/polars.rb +50 -0
- metadata +89 -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
|
+
# groupby 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._timedelta_to_pl_duration(period)
|
20
|
+
offset = Utils._timedelta_to_pl_duration(offset)
|
21
|
+
every = Utils._timedelta_to_pl_duration(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)
|
36
|
+
@df.lazy
|
37
|
+
.groupby_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)
|
49
|
+
.collect(no_optimization: true, string_cache: false)
|
50
|
+
end
|
51
|
+
end
|
52
|
+
end
|
@@ -0,0 +1,20 @@
|
|
1
|
+
module Polars
|
2
|
+
# @private
|
3
|
+
class Error < StandardError; end
|
4
|
+
|
5
|
+
# @private
|
6
|
+
class RowsException < Error; end
|
7
|
+
|
8
|
+
# @private
|
9
|
+
class TooManyRowsReturned < RowsException; end
|
10
|
+
|
11
|
+
# @private
|
12
|
+
class NoRowsReturned < RowsException; end
|
13
|
+
|
14
|
+
# @private
|
15
|
+
class Todo < Error
|
16
|
+
def message
|
17
|
+
"not implemented yet"
|
18
|
+
end
|
19
|
+
end
|
20
|
+
end
|