polars-df 0.15.0-arm64-darwin → 0.17.0-arm64-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.
@@ -431,7 +431,9 @@ module Polars
431
431
  projection_pushdown: true,
432
432
  simplify_expression: true,
433
433
  no_optimization: false,
434
- slice_pushdown: true
434
+ slice_pushdown: true,
435
+ storage_options: nil,
436
+ retries: 2
435
437
  )
436
438
  lf = _set_sink_optimizations(
437
439
  type_coercion: type_coercion,
@@ -460,6 +462,12 @@ module Polars
460
462
  }
461
463
  end
462
464
 
465
+ if storage_options&.any?
466
+ storage_options = storage_options.to_a
467
+ else
468
+ storage_options = nil
469
+ end
470
+
463
471
  lf.sink_parquet(
464
472
  path,
465
473
  compression,
@@ -467,7 +475,9 @@ module Polars
467
475
  statistics,
468
476
  row_group_size,
469
477
  data_pagesize_limit,
470
- maintain_order
478
+ maintain_order,
479
+ storage_options,
480
+ retries
471
481
  )
472
482
  end
473
483
 
@@ -512,6 +522,10 @@ module Polars
512
522
  slice_pushdown: true,
513
523
  no_optimization: false
514
524
  )
525
+ # TODO support storage options in Rust
526
+ storage_options = nil
527
+ retries = 2
528
+
515
529
  lf = _set_sink_optimizations(
516
530
  type_coercion: type_coercion,
517
531
  predicate_pushdown: predicate_pushdown,
@@ -521,10 +535,18 @@ module Polars
521
535
  no_optimization: no_optimization
522
536
  )
523
537
 
538
+ if storage_options&.any?
539
+ storage_options = storage_options.to_a
540
+ else
541
+ storage_options = nil
542
+ end
543
+
524
544
  lf.sink_ipc(
525
545
  path,
526
546
  compression,
527
- maintain_order
547
+ maintain_order,
548
+ storage_options,
549
+ retries
528
550
  )
529
551
  end
530
552
 
@@ -692,7 +714,9 @@ module Polars
692
714
  projection_pushdown: true,
693
715
  simplify_expression: true,
694
716
  slice_pushdown: true,
695
- no_optimization: false
717
+ no_optimization: false,
718
+ storage_options: nil,
719
+ retries: 2
696
720
  )
697
721
  lf = _set_sink_optimizations(
698
722
  type_coercion: type_coercion,
@@ -703,7 +727,13 @@ module Polars
703
727
  no_optimization: no_optimization
704
728
  )
705
729
 
706
- lf.sink_json(path, maintain_order)
730
+ if storage_options&.any?
731
+ storage_options = storage_options.to_a
732
+ else
733
+ storage_options = nil
734
+ end
735
+
736
+ lf.sink_json(path, maintain_order, storage_options, retries)
707
737
  end
708
738
 
709
739
  # @private
@@ -1586,6 +1616,14 @@ module Polars
1586
1616
  # - true: -> Always coalesce join columns.
1587
1617
  # - false: -> Never coalesce join columns.
1588
1618
  # Note that joining on any other expressions than `col` will turn off coalescing.
1619
+ # @param allow_exact_matches [Boolean]
1620
+ # Whether exact matches are valid join predicates.
1621
+ # - If true, allow matching with the same `on` value (i.e. less-than-or-equal-to / greater-than-or-equal-to).
1622
+ # - If false, don't match the same `on` value (i.e., strictly less-than / strictly greater-than).
1623
+ # @param check_sortedness [Boolean]
1624
+ # Check the sortedness of the asof keys. If the keys are not sorted Polars
1625
+ # will error, or in case of 'by' argument raise a warning. This might become
1626
+ # a hard error in the future.
1589
1627
  #
1590
1628
  # @return [LazyFrame]
1591
1629
  #
@@ -1785,7 +1823,9 @@ module Polars
1785
1823
  tolerance: nil,
1786
1824
  allow_parallel: true,
1787
1825
  force_parallel: false,
1788
- coalesce: true
1826
+ coalesce: true,
1827
+ allow_exact_matches: true,
1828
+ check_sortedness: true
1789
1829
  )
1790
1830
  if !other.is_a?(LazyFrame)
1791
1831
  raise ArgumentError, "Expected a `LazyFrame` as join table, got #{other.class.name}"
@@ -1841,7 +1881,9 @@ module Polars
1841
1881
  strategy,
1842
1882
  tolerance_num,
1843
1883
  tolerance_str,
1844
- coalesce
1884
+ coalesce,
1885
+ allow_exact_matches,
1886
+ check_sortedness
1845
1887
  )
1846
1888
  )
1847
1889
  end
@@ -372,9 +372,91 @@ module Polars
372
372
  # def by_index
373
373
  # end
374
374
 
375
- # TODO
376
- # def by_name
377
- # end
375
+ # Select all columns matching the given names.
376
+ #
377
+ # @param names [Array]
378
+ # One or more names of columns to select.
379
+ # @param require_all [Boolean]
380
+ # Whether to match *all* names (the default) or *any* of the names.
381
+ #
382
+ # @return [SelectorProxy]
383
+ #
384
+ # @note
385
+ # Matching columns are returned in the order in which they are declared in
386
+ # the selector, not the underlying schema order.
387
+ #
388
+ # @example
389
+ # df = Polars::DataFrame.new(
390
+ # {
391
+ # "foo" => ["x", "y"],
392
+ # "bar" => [123, 456],
393
+ # "baz" => [2.0, 5.5],
394
+ # "zap" => [false, true]
395
+ # }
396
+ # )
397
+ #
398
+ # @example Select columns by name:
399
+ # df.select(Polars.cs.by_name("foo", "bar"))
400
+ # # =>
401
+ # # shape: (2, 2)
402
+ # # ┌─────┬─────┐
403
+ # # │ foo ┆ bar │
404
+ # # │ --- ┆ --- │
405
+ # # │ str ┆ i64 │
406
+ # # ╞═════╪═════╡
407
+ # # │ x ┆ 123 │
408
+ # # │ y ┆ 456 │
409
+ # # └─────┴─────┘
410
+ #
411
+ # @example Match *any* of the given columns by name:
412
+ # df.select(Polars.cs.by_name("baz", "moose", "foo", "bear", require_all: false))
413
+ # # =>
414
+ # # shape: (2, 2)
415
+ # # ┌─────┬─────┐
416
+ # # │ foo ┆ baz │
417
+ # # │ --- ┆ --- │
418
+ # # │ str ┆ f64 │
419
+ # # ╞═════╪═════╡
420
+ # # │ x ┆ 2.0 │
421
+ # # │ y ┆ 5.5 │
422
+ # # └─────┴─────┘
423
+ #
424
+ # @example Match all columns *except* for those given:
425
+ # df.select(~Polars.cs.by_name("foo", "bar"))
426
+ # # =>
427
+ # # shape: (2, 2)
428
+ # # ┌─────┬───────┐
429
+ # # │ baz ┆ zap │
430
+ # # │ --- ┆ --- │
431
+ # # │ f64 ┆ bool │
432
+ # # ╞═════╪═══════╡
433
+ # # │ 2.0 ┆ false │
434
+ # # │ 5.5 ┆ true │
435
+ # # └─────┴───────┘
436
+ def self.by_name(*names, require_all: true)
437
+ all_names = []
438
+ names.each do |nm|
439
+ if nm.is_a?(::String)
440
+ all_names << nm
441
+ else
442
+ msg = "invalid name: #{nm.inspect}"
443
+ raise TypeError, msg
444
+ end
445
+ end
446
+
447
+ selector_params = {"*names" => all_names}
448
+ match_cols = all_names
449
+ if !require_all
450
+ match_cols = "^(#{all_names.map { |nm| Utils.re_escape(nm) }.join("|")})$"
451
+ selector_params["require_all"] = require_all
452
+ end
453
+
454
+ _selector_proxy_(
455
+ F.col(match_cols),
456
+ name: "by_name",
457
+ parameters: selector_params
458
+ )
459
+ end
378
460
 
379
461
  # Select all categorical columns.
380
462
  #
data/lib/polars/series.rb CHANGED
@@ -4696,7 +4696,12 @@ module Polars
4696
4696
  end
4697
4697
 
4698
4698
  constructor = polars_type_to_constructor(dtype)
4699
- rbseries = constructor.call(name, values, strict)
4699
+ rbseries =
4700
+ if dtype == Array
4701
+ constructor.call(name, values, strict)
4702
+ else
4703
+ construct_series_with_fallbacks(constructor, name, values, dtype, strict: strict)
4704
+ end
4700
4705
 
4701
4706
  base_type = dtype.is_a?(DataType) ? dtype.class : dtype
4702
4707
  if [Date, Datetime, Duration, Time, Categorical, Boolean, Enum, Decimal].include?(base_type)
@@ -1,4 +1,4 @@
1
1
  module Polars
2
2
  # @private
3
- VERSION = "0.15.0"
3
+ VERSION = "0.17.0"
4
4
  end
data/lib/polars.rb CHANGED
@@ -49,6 +49,7 @@ require_relative "polars/group_by"
49
49
  require_relative "polars/io/avro"
50
50
  require_relative "polars/io/csv"
51
51
  require_relative "polars/io/database"
52
+ require_relative "polars/io/delta"
52
53
  require_relative "polars/io/ipc"
53
54
  require_relative "polars/io/json"
54
55
  require_relative "polars/io/ndjson"
@@ -89,4 +90,18 @@ module Polars
89
90
 
90
91
  # @private
91
92
  N_INFER_DEFAULT = 100
93
+
94
+ # @private
95
+ class ArrowArrayStream
96
+ def arrow_c_stream
97
+ self
98
+ end
99
+ end
100
+
101
+ # Return the number of threads in the Polars thread pool.
102
+ #
103
+ # @return [Integer]
104
+ def self.thread_pool_size
105
+ Plr.thread_pool_size
106
+ end
92
107
  end
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.15.0
4
+ version: 0.17.0
5
5
  platform: arm64-darwin
6
6
  authors:
7
7
  - Andrew Kane
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2024-11-20 00:00:00.000000000 Z
11
+ date: 2025-01-28 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bigdecimal
@@ -24,7 +24,6 @@ dependencies:
24
24
  - - ">="
25
25
  - !ruby/object:Gem::Version
26
26
  version: '0'
27
- force_ruby_platform: false
28
27
  description:
29
28
  email: andrew@ankane.org
30
29
  executables: []
@@ -40,9 +39,9 @@ files:
40
39
  - README.md
41
40
  - lib/polars-df.rb
42
41
  - lib/polars.rb
43
- - lib/polars/3.1/polars.bundle
44
42
  - lib/polars/3.2/polars.bundle
45
43
  - lib/polars/3.3/polars.bundle
44
+ - lib/polars/3.4/polars.bundle
46
45
  - lib/polars/array_expr.rb
47
46
  - lib/polars/array_name_space.rb
48
47
  - lib/polars/batched_csv_reader.rb
@@ -80,6 +79,7 @@ files:
80
79
  - lib/polars/io/avro.rb
81
80
  - lib/polars/io/csv.rb
82
81
  - lib/polars/io/database.rb
82
+ - lib/polars/io/delta.rb
83
83
  - lib/polars/io/ipc.rb
84
84
  - lib/polars/io/json.rb
85
85
  - lib/polars/io/ndjson.rb
@@ -122,17 +122,17 @@ required_ruby_version: !ruby/object:Gem::Requirement
122
122
  requirements:
123
123
  - - ">="
124
124
  - !ruby/object:Gem::Version
125
- version: '3.1'
125
+ version: '3.2'
126
126
  - - "<"
127
127
  - !ruby/object:Gem::Version
128
- version: 3.4.dev
128
+ version: 3.5.dev
129
129
  required_rubygems_version: !ruby/object:Gem::Requirement
130
130
  requirements:
131
131
  - - ">="
132
132
  - !ruby/object:Gem::Version
133
133
  version: '0'
134
134
  requirements: []
135
- rubygems_version: 3.4.4
135
+ rubygems_version: 3.5.23
136
136
  signing_key:
137
137
  specification_version: 4
138
138
  summary: Blazingly fast DataFrames for Ruby