polars-df 0.9.0-arm64-darwin → 0.11.0-arm64-darwin

Sign up to get free protection for your applications and to get access to all the features.
Files changed (43) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +23 -0
  3. data/Cargo.lock +144 -57
  4. data/LICENSE-THIRD-PARTY.txt +629 -29
  5. data/README.md +7 -6
  6. data/lib/polars/3.1/polars.bundle +0 -0
  7. data/lib/polars/3.2/polars.bundle +0 -0
  8. data/lib/polars/3.3/polars.bundle +0 -0
  9. data/lib/polars/array_expr.rb +6 -2
  10. data/lib/polars/batched_csv_reader.rb +11 -3
  11. data/lib/polars/convert.rb +6 -1
  12. data/lib/polars/data_frame.rb +225 -370
  13. data/lib/polars/date_time_expr.rb +11 -4
  14. data/lib/polars/date_time_name_space.rb +14 -4
  15. data/lib/polars/dynamic_group_by.rb +2 -2
  16. data/lib/polars/exceptions.rb +4 -0
  17. data/lib/polars/expr.rb +1171 -54
  18. data/lib/polars/functions/lazy.rb +3 -3
  19. data/lib/polars/functions/range/date_range.rb +92 -0
  20. data/lib/polars/functions/range/datetime_range.rb +149 -0
  21. data/lib/polars/functions/range/time_range.rb +141 -0
  22. data/lib/polars/functions/whenthen.rb +74 -5
  23. data/lib/polars/group_by.rb +88 -23
  24. data/lib/polars/io/avro.rb +24 -0
  25. data/lib/polars/{io.rb → io/csv.rb} +307 -489
  26. data/lib/polars/io/database.rb +73 -0
  27. data/lib/polars/io/ipc.rb +247 -0
  28. data/lib/polars/io/json.rb +18 -0
  29. data/lib/polars/io/ndjson.rb +69 -0
  30. data/lib/polars/io/parquet.rb +226 -0
  31. data/lib/polars/lazy_frame.rb +55 -195
  32. data/lib/polars/lazy_group_by.rb +100 -3
  33. data/lib/polars/list_expr.rb +6 -2
  34. data/lib/polars/rolling_group_by.rb +2 -2
  35. data/lib/polars/series.rb +14 -12
  36. data/lib/polars/string_expr.rb +38 -36
  37. data/lib/polars/utils.rb +89 -1
  38. data/lib/polars/version.rb +1 -1
  39. data/lib/polars/whenthen.rb +83 -0
  40. data/lib/polars.rb +10 -3
  41. metadata +13 -6
  42. data/lib/polars/when.rb +0 -16
  43. data/lib/polars/when_then.rb +0 -19
data/README.md CHANGED
@@ -1,8 +1,8 @@
1
- # Polars Ruby
1
+ # Ruby Polars
2
2
 
3
3
  :fire: Blazingly fast DataFrames for Ruby, powered by [Polars](https://github.com/pola-rs/polars)
4
4
 
5
- [![Build Status](https://github.com/ankane/polars-ruby/actions/workflows/build.yml/badge.svg)](https://github.com/ankane/polars-ruby/actions)
5
+ [![Build Status](https://github.com/ankane/ruby-polars/actions/workflows/build.yml/badge.svg)](https://github.com/ankane/ruby-polars/actions)
6
6
 
7
7
  ## Installation
8
8
 
@@ -420,17 +420,18 @@ View the [changelog](CHANGELOG.md)
420
420
 
421
421
  Everyone is encouraged to help improve this project. Here are a few ways you can help:
422
422
 
423
- - [Report bugs](https://github.com/ankane/polars-ruby/issues)
424
- - Fix bugs and [submit pull requests](https://github.com/ankane/polars-ruby/pulls)
423
+ - [Report bugs](https://github.com/ankane/ruby-polars/issues)
424
+ - Fix bugs and [submit pull requests](https://github.com/ankane/ruby-polars/pulls)
425
425
  - Write, clarify, or fix documentation
426
426
  - Suggest or add new features
427
427
 
428
428
  To get started with development:
429
429
 
430
430
  ```sh
431
- git clone https://github.com/ankane/polars-ruby.git
432
- cd polars-ruby
431
+ git clone https://github.com/ankane/ruby-polars.git
432
+ cd ruby-polars
433
433
  bundle install
434
434
  bundle exec rake compile
435
435
  bundle exec rake test
436
+ bundle exec rake test:docs
436
437
  ```
Binary file
Binary file
Binary file
@@ -333,6 +333,10 @@ module Polars
333
333
  #
334
334
  # @param index [Integer]
335
335
  # Index to return per sub-array
336
+ # @param null_on_oob [Boolean]
337
+ # Behavior if an index is out of bounds:
338
+ # true -> set as null
339
+ # false -> raise an error
336
340
  #
337
341
  # @return [Expr]
338
342
  #
@@ -353,9 +357,9 @@ module Polars
353
357
  # # │ [4, 5, 6] ┆ -2 ┆ 5 │
354
358
  # # │ [7, 8, 9] ┆ 4 ┆ null │
355
359
  # # └───────────────┴─────┴──────┘
356
- def get(index)
360
+ def get(index, null_on_oob: true)
357
361
  index = Utils.parse_as_expression(index)
358
- Utils.wrap_expr(_rbexpr.arr_get(index))
362
+ Utils.wrap_expr(_rbexpr.arr_get(index, null_on_oob))
359
363
  end
360
364
 
361
365
  # Get the first value of the sub-arrays.
@@ -13,6 +13,7 @@ module Polars
13
13
  skip_rows: 0,
14
14
  dtypes: nil,
15
15
  null_values: nil,
16
+ missing_utf8_is_empty_string: false,
16
17
  ignore_errors: false,
17
18
  parse_dates: false,
18
19
  n_threads: nil,
@@ -27,10 +28,13 @@ module Polars
27
28
  row_count_offset: 0,
28
29
  sample_size: 1024,
29
30
  eol_char: "\n",
30
- new_columns: nil
31
+ new_columns: nil,
32
+ raise_if_empty: true,
33
+ truncate_ragged_lines: false,
34
+ decimal_comma: false
31
35
  )
32
36
  if Utils.pathlike?(file)
33
- path = Utils.normalise_filepath(file)
37
+ path = Utils.normalize_filepath(file)
34
38
  end
35
39
 
36
40
  dtype_list = nil
@@ -71,11 +75,15 @@ module Polars
71
75
  comment_char,
72
76
  quote_char,
73
77
  processed_null_values,
78
+ missing_utf8_is_empty_string,
74
79
  parse_dates,
75
80
  skip_rows_after_header,
76
81
  Utils._prepare_row_count_args(row_count_name, row_count_offset),
77
82
  sample_size,
78
- eol_char
83
+ eol_char,
84
+ raise_if_empty,
85
+ truncate_ragged_lines,
86
+ decimal_comma
79
87
  )
80
88
  self.new_columns = new_columns
81
89
  end
@@ -27,7 +27,12 @@ module Polars
27
27
  # # │ 2 ┆ 4 │
28
28
  # # └─────┴─────┘
29
29
  def from_hash(data, schema: nil, columns: nil)
30
- DataFrame._from_hash(data, schema: schema || columns)
30
+ Utils.wrap_df(
31
+ DataFrame.hash_to_rbdf(
32
+ data,
33
+ schema: schema || columns
34
+ )
35
+ )
31
36
  end
32
37
 
33
38
  # Construct a DataFrame from a sequence of dictionaries. This operation clones data.