polars-df 0.2.0-x86_64-darwin

Sign up to get free protection for your applications and to get access to all the features.
Files changed (46) hide show
  1. checksums.yaml +7 -0
  2. data/.yardopts +3 -0
  3. data/CHANGELOG.md +33 -0
  4. data/Cargo.lock +2230 -0
  5. data/Cargo.toml +10 -0
  6. data/LICENSE-THIRD-PARTY.txt +38856 -0
  7. data/LICENSE.txt +20 -0
  8. data/README.md +91 -0
  9. data/lib/polars/3.0/polars.bundle +0 -0
  10. data/lib/polars/3.1/polars.bundle +0 -0
  11. data/lib/polars/3.2/polars.bundle +0 -0
  12. data/lib/polars/batched_csv_reader.rb +96 -0
  13. data/lib/polars/cat_expr.rb +52 -0
  14. data/lib/polars/cat_name_space.rb +54 -0
  15. data/lib/polars/convert.rb +100 -0
  16. data/lib/polars/data_frame.rb +4833 -0
  17. data/lib/polars/data_types.rb +122 -0
  18. data/lib/polars/date_time_expr.rb +1418 -0
  19. data/lib/polars/date_time_name_space.rb +1484 -0
  20. data/lib/polars/dynamic_group_by.rb +52 -0
  21. data/lib/polars/exceptions.rb +20 -0
  22. data/lib/polars/expr.rb +5307 -0
  23. data/lib/polars/expr_dispatch.rb +22 -0
  24. data/lib/polars/functions.rb +453 -0
  25. data/lib/polars/group_by.rb +558 -0
  26. data/lib/polars/io.rb +814 -0
  27. data/lib/polars/lazy_frame.rb +2442 -0
  28. data/lib/polars/lazy_functions.rb +1195 -0
  29. data/lib/polars/lazy_group_by.rb +93 -0
  30. data/lib/polars/list_expr.rb +610 -0
  31. data/lib/polars/list_name_space.rb +346 -0
  32. data/lib/polars/meta_expr.rb +54 -0
  33. data/lib/polars/rolling_group_by.rb +35 -0
  34. data/lib/polars/series.rb +3730 -0
  35. data/lib/polars/slice.rb +104 -0
  36. data/lib/polars/string_expr.rb +972 -0
  37. data/lib/polars/string_name_space.rb +690 -0
  38. data/lib/polars/struct_expr.rb +100 -0
  39. data/lib/polars/struct_name_space.rb +64 -0
  40. data/lib/polars/utils.rb +192 -0
  41. data/lib/polars/version.rb +4 -0
  42. data/lib/polars/when.rb +16 -0
  43. data/lib/polars/when_then.rb +19 -0
  44. data/lib/polars-df.rb +1 -0
  45. data/lib/polars.rb +50 -0
  46. 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