polars-df 0.16.0-x86_64-darwin → 0.17.0-x86_64-darwin

Sign up to get free protection for your applications and to get access to all the features.
data/LICENSE.txt CHANGED
@@ -1,5 +1,5 @@
1
1
  Copyright (c) 2020 Ritchie Vink
2
- Copyright (c) 2022-2024 Andrew Kane
2
+ Copyright (c) 2022-2025 Andrew Kane
3
3
  Some portions Copyright (c) 2024 NVIDIA CORPORATION & AFFILIATES. All rights reserved.
4
4
 
5
5
  Permission is hereby granted, free of charge, to any person obtaining a copy
data/README.md CHANGED
@@ -88,7 +88,7 @@ From Avro
88
88
  Polars.read_avro("file.avro")
89
89
  ```
90
90
 
91
- From Delta Lake (requires [deltalake-rb](https://github.com/ankane/delta-ruby)) [experimental, unreleased]
91
+ From Delta Lake (requires [deltalake-rb](https://github.com/ankane/delta-ruby)) [experimental]
92
92
 
93
93
  ```ruby
94
94
  Polars.read_delta("./table")
@@ -365,7 +365,7 @@ Avro
365
365
  df.write_avro("file.avro")
366
366
  ```
367
367
 
368
- Delta Lake [experimental, unreleased]
368
+ Delta Lake [experimental]
369
369
 
370
370
  ```ruby
371
371
  df.write_delta("./table")
Binary file
Binary file
Binary file
@@ -604,10 +604,6 @@ module Polars
604
604
  #
605
605
  # @param file [String]
606
606
  # File path to which the result should be written.
607
- # @param pretty [Boolean]
608
- # Pretty serialize json.
609
- # @param row_oriented [Boolean]
610
- # Write to row oriented json. This is slower, but more common.
611
607
  #
612
608
  # @return [nil]
613
609
  #
@@ -619,16 +615,8 @@ module Polars
619
615
  # }
620
616
  # )
621
617
  # df.write_json
622
- # # => "{\"columns\":[{\"name\":\"foo\",\"datatype\":\"Int64\",\"bit_settings\":\"\",\"values\":[1,2,3]},{\"name\":\"bar\",\"datatype\":\"Int64\",\"bit_settings\":\"\",\"values\":[6,7,8]}]}"
623
- #
624
- # @example
625
- # df.write_json(row_oriented: true)
626
618
  # # => "[{\"foo\":1,\"bar\":6},{\"foo\":2,\"bar\":7},{\"foo\":3,\"bar\":8}]"
627
- def write_json(
628
- file = nil,
629
- pretty: false,
630
- row_oriented: false
631
- )
619
+ def write_json(file = nil)
632
620
  if Utils.pathlike?(file)
633
621
  file = Utils.normalize_filepath(file)
634
622
  end
@@ -636,7 +624,7 @@ module Polars
636
624
  if file.nil? || to_string_io
637
625
  buf = StringIO.new
638
626
  buf.set_encoding(Encoding::BINARY)
639
- _df.write_json(buf, pretty, row_oriented)
627
+ _df.write_json(buf)
640
628
  json_bytes = buf.string
641
629
 
642
630
  json_str = json_bytes.force_encoding(Encoding::UTF_8)
@@ -646,7 +634,7 @@ module Polars
646
634
  return json_str
647
635
  end
648
636
  else
649
- _df.write_json(file, pretty, row_oriented)
637
+ _df.write_json(file)
650
638
  end
651
639
  nil
652
640
  end
@@ -2294,6 +2282,14 @@ module Polars
2294
2282
  # keys are within this distance. If an asof join is done on columns of dtype
2295
2283
  # "Date", "Datetime", "Duration" or "Time" you use the following string
2296
2284
  # language:
2285
+ # @param allow_exact_matches [Boolean]
2286
+ # Whether exact matches are valid join predicates.
2287
+ # - If true, allow matching with the same `on` value (i.e. less-than-or-equal-to / greater-than-or-equal-to).
2288
+ # - If false, don't match the same `on` value (i.e., strictly less-than / strictly greater-than).
2289
+ # @param check_sortedness [Boolean]
2290
+ # Check the sortedness of the asof keys. If the keys are not sorted Polars
2291
+ # will error, or in case of 'by' argument raise a warning. This might become
2292
+ # a hard error in the future.
2297
2293
  #
2298
2294
  # - 1ns (1 nanosecond)
2299
2295
  # - 1us (1 microsecond)
@@ -2375,7 +2371,9 @@ module Polars
2375
2371
  tolerance: nil,
2376
2372
  allow_parallel: true,
2377
2373
  force_parallel: false,
2378
- coalesce: true
2374
+ coalesce: true,
2375
+ allow_exact_matches: true,
2376
+ check_sortedness: true
2379
2377
  )
2380
2378
  lazy
2381
2379
  .join_asof(
@@ -2391,7 +2389,9 @@ module Polars
2391
2389
  tolerance: tolerance,
2392
2390
  allow_parallel: allow_parallel,
2393
2391
  force_parallel: force_parallel,
2394
- coalesce: coalesce
2392
+ coalesce: coalesce,
2393
+ allow_exact_matches: allow_exact_matches,
2394
+ check_sortedness: check_sortedness
2395
2395
  )
2396
2396
  .collect(no_optimization: true)
2397
2397
  end
@@ -167,6 +167,10 @@ module Polars
167
167
  class Int64 < SignedIntegerType
168
168
  end
169
169
 
170
+ # 128-bit signed integer type.
171
+ class Int128 < SignedIntegerType
172
+ end
173
+
170
174
  # 8-bit unsigned integer type.
171
175
  class UInt8 < UnsignedIntegerType
172
176
  end
@@ -1616,6 +1616,14 @@ module Polars
1616
1616
  # - true: -> Always coalesce join columns.
1617
1617
  # - false: -> Never coalesce join columns.
1618
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.
1619
1627
  #
1620
1628
  # @return [LazyFrame]
1621
1629
  #
@@ -1815,7 +1823,9 @@ module Polars
1815
1823
  tolerance: nil,
1816
1824
  allow_parallel: true,
1817
1825
  force_parallel: false,
1818
- coalesce: true
1826
+ coalesce: true,
1827
+ allow_exact_matches: true,
1828
+ check_sortedness: true
1819
1829
  )
1820
1830
  if !other.is_a?(LazyFrame)
1821
1831
  raise ArgumentError, "Expected a `LazyFrame` as join table, got #{other.class.name}"
@@ -1871,7 +1881,9 @@ module Polars
1871
1881
  strategy,
1872
1882
  tolerance_num,
1873
1883
  tolerance_str,
1874
- coalesce
1884
+ coalesce,
1885
+ allow_exact_matches,
1886
+ check_sortedness
1875
1887
  )
1876
1888
  )
1877
1889
  end
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.16.0"
3
+ VERSION = "0.17.0"
4
4
  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.16.0
4
+ version: 0.17.0
5
5
  platform: x86_64-darwin
6
6
  authors:
7
7
  - Andrew Kane
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2024-12-29 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