polars-df 0.7.0-x86_64-linux → 0.8.0-x86_64-linux

Sign up to get free protection for your applications and to get access to all the features.
data/lib/polars/series.rb CHANGED
@@ -34,7 +34,7 @@ module Polars
34
34
  # s3 = Polars::Series.new([1, 2, 3])
35
35
  def initialize(name = nil, values = nil, dtype: nil, strict: true, nan_to_null: false, dtype_if_empty: nil)
36
36
  # Handle case where values are passed as the first argument
37
- if !name.nil? && !name.is_a?(String)
37
+ if !name.nil? && !name.is_a?(::String)
38
38
  if values.nil?
39
39
  values = name
40
40
  name = nil
@@ -46,7 +46,7 @@ module Polars
46
46
  name = "" if name.nil?
47
47
 
48
48
  # TODO improve
49
- if values.is_a?(Range) && values.begin.is_a?(String)
49
+ if values.is_a?(Range) && values.begin.is_a?(::String)
50
50
  values = values.to_a
51
51
  end
52
52
 
@@ -341,7 +341,7 @@ module Polars
341
341
  def []=(key, value)
342
342
  if value.is_a?(::Array)
343
343
  if is_numeric || is_datelike
344
- set_at_idx(key, value)
344
+ scatter(key, value)
345
345
  return
346
346
  end
347
347
  raise ArgumentError, "cannot set Series of dtype: #{dtype} with list/tuple as value; use a scalar value"
@@ -351,9 +351,9 @@ module Polars
351
351
  if key.dtype == Boolean
352
352
  self._s = set(key, value)._s
353
353
  elsif key.dtype == UInt64
354
- self._s = set_at_idx(key.cast(UInt32), value)._s
354
+ self._s = scatter(key.cast(UInt32), value)._s
355
355
  elsif key.dtype == UInt32
356
- self._s = set_at_idx(key, value)._s
356
+ self._s = scatter(key, value)._s
357
357
  else
358
358
  raise Todo
359
359
  end
@@ -735,6 +735,212 @@ module Polars
735
735
  Utils.wrap_df(_s.to_dummies(separator, drop_first))
736
736
  end
737
737
 
738
+ # Bin continuous values into discrete categories.
739
+ #
740
+ # @param breaks [Array]
741
+ # List of unique cut points.
742
+ # @param labels [Array]
743
+ # Names of the categories. The number of labels must be equal to the number
744
+ # of cut points plus one.
745
+ # @param left_closed [Boolean]
746
+ # Set the intervals to be left-closed instead of right-closed.
747
+ # @param include_breaks [Boolean]
748
+ # Include a column with the right endpoint of the bin each observation falls
749
+ # in. This will change the data type of the output from a
750
+ # `Categorical` to a `Struct`.
751
+ #
752
+ # @return [Series]
753
+ #
754
+ # @example Divide the column into three categories.
755
+ # s = Polars::Series.new("foo", [-2, -1, 0, 1, 2])
756
+ # s.cut([-1, 1], labels: ["a", "b", "c"])
757
+ # # =>
758
+ # # shape: (5,)
759
+ # # Series: 'foo' [cat]
760
+ # # [
761
+ # # "a"
762
+ # # "a"
763
+ # # "b"
764
+ # # "b"
765
+ # # "c"
766
+ # # ]
767
+ #
768
+ # @example Create a DataFrame with the breakpoint and category for each value.
769
+ # cut = s.cut([-1, 1], include_breaks: true).alias("cut")
770
+ # s.to_frame.with_columns(cut).unnest("cut")
771
+ # # =>
772
+ # # shape: (5, 3)
773
+ # # ┌─────┬─────────────┬────────────┐
774
+ # # │ foo ┆ break_point ┆ category │
775
+ # # │ --- ┆ --- ┆ --- │
776
+ # # │ i64 ┆ f64 ┆ cat │
777
+ # # ╞═════╪═════════════╪════════════╡
778
+ # # │ -2 ┆ -1.0 ┆ (-inf, -1] │
779
+ # # │ -1 ┆ -1.0 ┆ (-inf, -1] │
780
+ # # │ 0 ┆ 1.0 ┆ (-1, 1] │
781
+ # # │ 1 ┆ 1.0 ┆ (-1, 1] │
782
+ # # │ 2 ┆ inf ┆ (1, inf] │
783
+ # # └─────┴─────────────┴────────────┘
784
+ def cut(breaks, labels: nil, left_closed: false, include_breaks: false)
785
+ result = (
786
+ to_frame
787
+ .select(
788
+ Polars.col(name).cut(
789
+ breaks,
790
+ labels: labels,
791
+ left_closed: left_closed,
792
+ include_breaks: include_breaks
793
+ )
794
+ )
795
+ .to_series
796
+ )
797
+
798
+ if include_breaks
799
+ result = result.struct.rename_fields(["break_point", "category"])
800
+ end
801
+
802
+ result
803
+ end
804
+
805
+ # Bin continuous values into discrete categories based on their quantiles.
806
+ #
807
+ # @param quantiles [Array]
808
+ # Either a list of quantile probabilities between 0 and 1 or a positive
809
+ # integer determining the number of bins with uniform probability.
810
+ # @param labels [Array]
811
+ # Names of the categories. The number of labels must be equal to the number
812
+ # of cut points plus one.
813
+ # @param left_closed [Boolean]
814
+ # Set the intervals to be left-closed instead of right-closed.
815
+ # @param allow_duplicates [Boolean]
816
+ # If set to `true`, duplicates in the resulting quantiles are dropped,
817
+ # rather than raising a `DuplicateError`. This can happen even with unique
818
+ # probabilities, depending on the data.
819
+ # @param include_breaks [Boolean]
820
+ # Include a column with the right endpoint of the bin each observation falls
821
+ # in. This will change the data type of the output from a
822
+ # `Categorical` to a `Struct`.
823
+ #
824
+ # @return [Series]
825
+ #
826
+ # @example Divide a column into three categories according to pre-defined quantile probabilities.
827
+ # s = Polars::Series.new("foo", [-2, -1, 0, 1, 2])
828
+ # s.qcut([0.25, 0.75], labels: ["a", "b", "c"])
829
+ # # =>
830
+ # # shape: (5,)
831
+ # # Series: 'foo' [cat]
832
+ # # [
833
+ # # "a"
834
+ # # "a"
835
+ # # "b"
836
+ # # "b"
837
+ # # "c"
838
+ # # ]
839
+ #
840
+ # @example Divide a column into two categories using uniform quantile probabilities.
841
+ # s.qcut(2, labels: ["low", "high"], left_closed: true)
842
+ # # =>
843
+ # # shape: (5,)
844
+ # # Series: 'foo' [cat]
845
+ # # [
846
+ # # "low"
847
+ # # "low"
848
+ # # "high"
849
+ # # "high"
850
+ # # "high"
851
+ # # ]
852
+ #
853
+ # @example Create a DataFrame with the breakpoint and category for each value.
854
+ # cut = s.qcut([0.25, 0.75], include_breaks: true).alias("cut")
855
+ # s.to_frame.with_columns(cut).unnest("cut")
856
+ # # =>
857
+ # # shape: (5, 3)
858
+ # # ┌─────┬─────────────┬────────────┐
859
+ # # │ foo ┆ break_point ┆ category │
860
+ # # │ --- ┆ --- ┆ --- │
861
+ # # │ i64 ┆ f64 ┆ cat │
862
+ # # ╞═════╪═════════════╪════════════╡
863
+ # # │ -2 ┆ -1.0 ┆ (-inf, -1] │
864
+ # # │ -1 ┆ -1.0 ┆ (-inf, -1] │
865
+ # # │ 0 ┆ 1.0 ┆ (-1, 1] │
866
+ # # │ 1 ┆ 1.0 ┆ (-1, 1] │
867
+ # # │ 2 ┆ inf ┆ (1, inf] │
868
+ # # └─────┴─────────────┴────────────┘
869
+ def qcut(quantiles, labels: nil, left_closed: false, allow_duplicates: false, include_breaks: false)
870
+ result = (
871
+ to_frame
872
+ .select(
873
+ Polars.col(name).qcut(
874
+ quantiles,
875
+ labels: labels,
876
+ left_closed: left_closed,
877
+ allow_duplicates: allow_duplicates,
878
+ include_breaks: include_breaks
879
+ )
880
+ )
881
+ .to_series
882
+ )
883
+
884
+ if include_breaks
885
+ result = result.struct.rename_fields(["break_point", "category"])
886
+ end
887
+
888
+ result
889
+ end
890
+
891
+ # Get the lengths of runs of identical values.
892
+ #
893
+ # @return [Series]
894
+ #
895
+ # @example
896
+ # s = Polars::Series.new("s", [1, 1, 2, 1, nil, 1, 3, 3])
897
+ # s.rle.struct.unnest
898
+ # # =>
899
+ # # shape: (6, 2)
900
+ # # ┌─────────┬────────┐
901
+ # # │ lengths ┆ values │
902
+ # # │ --- ┆ --- │
903
+ # # │ i32 ┆ i64 │
904
+ # # ╞═════════╪════════╡
905
+ # # │ 2 ┆ 1 │
906
+ # # │ 1 ┆ 2 │
907
+ # # │ 1 ┆ 1 │
908
+ # # │ 1 ┆ null │
909
+ # # │ 1 ┆ 1 │
910
+ # # │ 2 ┆ 3 │
911
+ # # └─────────┴────────┘
912
+ def rle
913
+ super
914
+ end
915
+
916
+ # Map values to run IDs.
917
+ #
918
+ # Similar to RLE, but it maps each value to an ID corresponding to the run into
919
+ # which it falls. This is especially useful when you want to define groups by
920
+ # runs of identical values rather than the values themselves.
921
+ #
922
+ # @return [Series]
923
+ #
924
+ # @example
925
+ # s = Polars::Series.new("s", [1, 1, 2, 1, nil, 1, 3, 3])
926
+ # s.rle_id()
927
+ # # =>
928
+ # # shape: (8,)
929
+ # # Series: 's' [u32]
930
+ # # [
931
+ # # 0
932
+ # # 0
933
+ # # 1
934
+ # # 2
935
+ # # 3
936
+ # # 4
937
+ # # 5
938
+ # # 5
939
+ # # ]
940
+ def rle_id
941
+ super
942
+ end
943
+
738
944
  # Count the unique values in a Series.
739
945
  #
740
946
  # @param sort [Boolean]
@@ -1248,15 +1454,45 @@ module Polars
1248
1454
 
1249
1455
  # Return the `k` largest elements.
1250
1456
  #
1251
- # If `reverse: true`, the smallest elements will be given.
1457
+ # @param k [Integer]
1458
+ # Number of elements to return.
1459
+ #
1460
+ # @return [Boolean]
1461
+ #
1462
+ # @example
1463
+ # s = Polars::Series.new("a", [2, 5, 1, 4, 3])
1464
+ # s.top_k(k: 3)
1465
+ # # =>
1466
+ # # shape: (3,)
1467
+ # # Series: 'a' [i64]
1468
+ # # [
1469
+ # # 5
1470
+ # # 4
1471
+ # # 3
1472
+ # # ]
1473
+ def top_k(k: 5)
1474
+ super
1475
+ end
1476
+
1477
+ # Return the `k` smallest elements.
1252
1478
  #
1253
1479
  # @param k [Integer]
1254
1480
  # Number of elements to return.
1255
- # @param reverse [Boolean]
1256
- # Return the smallest elements.
1257
1481
  #
1258
1482
  # @return [Boolean]
1259
- def top_k(k: 5, reverse: false)
1483
+ #
1484
+ # @example
1485
+ # s = Polars::Series.new("a", [2, 5, 1, 4, 3])
1486
+ # s.bottom_k(k: 3)
1487
+ # # =>
1488
+ # # shape: (3,)
1489
+ # # Series: 'a' [i64]
1490
+ # # [
1491
+ # # 1
1492
+ # # 2
1493
+ # # 3
1494
+ # # ]
1495
+ def bottom_k(k: 5)
1260
1496
  super
1261
1497
  end
1262
1498
 
@@ -1705,26 +1941,40 @@ module Polars
1705
1941
  # @example
1706
1942
  # s = Polars::Series.new("a", [1, 2, 3])
1707
1943
  # s2 = Polars::Series.new("b", [4, 5, 6])
1708
- # s.series_equal(s)
1944
+ # s.equals(s)
1709
1945
  # # => true
1710
- # s.series_equal(s2)
1946
+ # s.equals(s2)
1711
1947
  # # => false
1712
- def series_equal(other, null_equal: false, strict: false)
1713
- _s.series_equal(other._s, null_equal, strict)
1948
+ def equals(other, null_equal: false, strict: false)
1949
+ _s.equals(other._s, null_equal, strict)
1714
1950
  end
1951
+ alias_method :series_equal, :equals
1715
1952
 
1716
- # Length of this Series.
1953
+ # Return the number of elements in the Series.
1717
1954
  #
1718
1955
  # @return [Integer]
1719
1956
  #
1720
1957
  # @example
1721
- # s = Polars::Series.new("a", [1, 2, 3])
1958
+ # s = Polars::Series.new("a", [1, 2, nil])
1959
+ # s.count
1960
+ # # => 3
1961
+ def count
1962
+ warn "`Series#count` will exclude null values in 0.9.0. Use `Series#length` instead."
1963
+ # len - null_count
1964
+ len
1965
+ end
1966
+
1967
+ # Return the number of elements in the Series.
1968
+ #
1969
+ # @return [Integer]
1970
+ #
1971
+ # @example
1972
+ # s = Polars::Series.new("a", [1, 2, nil])
1722
1973
  # s.len
1723
1974
  # # => 3
1724
1975
  def len
1725
1976
  _s.len
1726
1977
  end
1727
- alias_method :count, :len
1728
1978
  alias_method :length, :len
1729
1979
  alias_method :size, :len
1730
1980
 
@@ -1886,7 +2136,7 @@ module Polars
1886
2136
  # s.is_utf8
1887
2137
  # # => true
1888
2138
  def is_utf8
1889
- dtype == Utf8
2139
+ dtype == String
1890
2140
  end
1891
2141
  alias_method :utf8?, :is_utf8
1892
2142
 
@@ -1982,7 +2232,7 @@ module Polars
1982
2232
  # # 10
1983
2233
  # # 3
1984
2234
  # # ]
1985
- def set_at_idx(idx, value)
2235
+ def scatter(idx, value)
1986
2236
  if idx.is_a?(Integer)
1987
2237
  idx = [idx]
1988
2238
  end
@@ -1991,7 +2241,7 @@ module Polars
1991
2241
  end
1992
2242
 
1993
2243
  idx = Series.new("", idx)
1994
- if value.is_a?(Integer) || value.is_a?(Float) || Utils.bool?(value) || value.is_a?(String) || value.nil?
2244
+ if value.is_a?(Integer) || value.is_a?(Float) || Utils.bool?(value) || value.is_a?(::String) || value.nil?
1995
2245
  value = Series.new("", [value])
1996
2246
 
1997
2247
  # if we need to set more than a single value, we extend it
@@ -2001,9 +2251,10 @@ module Polars
2001
2251
  elsif !value.is_a?(Series)
2002
2252
  value = Series.new("", value)
2003
2253
  end
2004
- _s.set_at_idx(idx._s, value._s)
2254
+ _s.scatter(idx._s, value._s)
2005
2255
  self
2006
2256
  end
2257
+ alias_method :set_at_idx, :scatter
2007
2258
 
2008
2259
  # Create an empty copy of the current Series.
2009
2260
  #
@@ -2830,7 +3081,8 @@ module Polars
2830
3081
  weights: nil,
2831
3082
  min_periods: nil,
2832
3083
  center: false,
2833
- ddof: 1
3084
+ ddof: 1,
3085
+ warn_if_unsorted: true
2834
3086
  )
2835
3087
  to_frame
2836
3088
  .select(
@@ -2839,7 +3091,8 @@ module Polars
2839
3091
  weights: weights,
2840
3092
  min_periods: min_periods,
2841
3093
  center: center,
2842
- ddof: ddof
3094
+ ddof: ddof,
3095
+ warn_if_unsorted: warn_if_unsorted
2843
3096
  )
2844
3097
  )
2845
3098
  .to_series
@@ -2883,7 +3136,8 @@ module Polars
2883
3136
  weights: nil,
2884
3137
  min_periods: nil,
2885
3138
  center: false,
2886
- ddof: 1
3139
+ ddof: 1,
3140
+ warn_if_unsorted: true
2887
3141
  )
2888
3142
  to_frame
2889
3143
  .select(
@@ -2892,7 +3146,8 @@ module Polars
2892
3146
  weights: weights,
2893
3147
  min_periods: min_periods,
2894
3148
  center: center,
2895
- ddof: ddof
3149
+ ddof: ddof,
3150
+ warn_if_unsorted: warn_if_unsorted
2896
3151
  )
2897
3152
  )
2898
3153
  .to_series
@@ -2934,7 +3189,8 @@ module Polars
2934
3189
  window_size,
2935
3190
  weights: nil,
2936
3191
  min_periods: nil,
2937
- center: false
3192
+ center: false,
3193
+ warn_if_unsorted: true
2938
3194
  )
2939
3195
  if min_periods.nil?
2940
3196
  min_periods = window_size
@@ -2946,7 +3202,8 @@ module Polars
2946
3202
  window_size,
2947
3203
  weights: weights,
2948
3204
  min_periods: min_periods,
2949
- center: center
3205
+ center: center,
3206
+ warn_if_unsorted: warn_if_unsorted
2950
3207
  )
2951
3208
  )
2952
3209
  .to_series
@@ -3005,7 +3262,8 @@ module Polars
3005
3262
  window_size: 2,
3006
3263
  weights: nil,
3007
3264
  min_periods: nil,
3008
- center: false
3265
+ center: false,
3266
+ warn_if_unsorted: true
3009
3267
  )
3010
3268
  if min_periods.nil?
3011
3269
  min_periods = window_size
@@ -3019,7 +3277,8 @@ module Polars
3019
3277
  window_size: window_size,
3020
3278
  weights: weights,
3021
3279
  min_periods: min_periods,
3022
- center: center
3280
+ center: center,
3281
+ warn_if_unsorted: warn_if_unsorted
3023
3282
  )
3024
3283
  )
3025
3284
  .to_series
@@ -3761,7 +4020,7 @@ module Polars
3761
4020
  return Utils.wrap_s(_s.send(op, other._s))
3762
4021
  end
3763
4022
 
3764
- if (other.is_a?(Float) || other.is_a?(::Date) || other.is_a?(::DateTime) || other.is_a?(::Time) || other.is_a?(String)) && !is_float
4023
+ if (other.is_a?(Float) || other.is_a?(::Date) || other.is_a?(::DateTime) || other.is_a?(::Time) || other.is_a?(::String)) && !is_float
3765
4024
  _s2 = sequence_to_rbseries(name, [other])
3766
4025
  return Utils.wrap_s(_s.send(op, _s2))
3767
4026
  end
@@ -3927,7 +4186,7 @@ module Polars
3927
4186
  return RbSeries.new_series_list(name, values, strict)
3928
4187
  else
3929
4188
  constructor =
3930
- if value.is_a?(String)
4189
+ if value.is_a?(::String)
3931
4190
  if value.encoding == Encoding::UTF_8
3932
4191
  RbSeries.method(:new_str)
3933
4192
  else
@@ -157,7 +157,7 @@ module Polars
157
157
  # ctx.unregister(["test1", "test3"]).tables
158
158
  # # => ["test2"]
159
159
  def unregister(names)
160
- if names.is_a?(String)
160
+ if names.is_a?(::String)
161
161
  names = [names]
162
162
  end
163
163
  names.each do |nm|
@@ -13,7 +13,7 @@ module Polars
13
13
  #
14
14
  # @return [Expr]
15
15
  def [](item)
16
- if item.is_a?(String)
16
+ if item.is_a?(::String)
17
17
  field(item)
18
18
  elsif item.is_a?(Integer)
19
19
  Utils.wrap_expr(_rbexpr.struct_field_by_index(item))
@@ -16,7 +16,7 @@ module Polars
16
16
  def [](item)
17
17
  if item.is_a?(Integer)
18
18
  field(fields[item])
19
- elsif item.is_a?(String)
19
+ elsif item.is_a?(::String)
20
20
  field(item)
21
21
  else
22
22
  raise ArgumentError, "expected type Integer or String, got #{item.class.name}"
data/lib/polars/utils.rb CHANGED
@@ -27,7 +27,7 @@ module Polars
27
27
  if obj.is_a?(Range)
28
28
  # size only works for numeric ranges
29
29
  obj.to_a.length
30
- elsif obj.is_a?(String)
30
+ elsif obj.is_a?(::String)
31
31
  nil
32
32
  else
33
33
  obj.length
@@ -116,7 +116,7 @@ module Polars
116
116
  end
117
117
 
118
118
  def self.selection_to_rbexpr_list(exprs)
119
- if exprs.is_a?(String) || exprs.is_a?(Symbol) || exprs.is_a?(Expr) || exprs.is_a?(Series)
119
+ if exprs.is_a?(::String) || exprs.is_a?(Symbol) || exprs.is_a?(Expr) || exprs.is_a?(Series)
120
120
  exprs = [exprs]
121
121
  end
122
122
 
@@ -124,9 +124,9 @@ module Polars
124
124
  end
125
125
 
126
126
  def self.expr_to_lit_or_expr(expr, str_to_lit: true)
127
- if (expr.is_a?(String) || expr.is_a?(Symbol)) && !str_to_lit
127
+ if (expr.is_a?(::String) || expr.is_a?(Symbol)) && !str_to_lit
128
128
  col(expr)
129
- elsif expr.is_a?(Integer) || expr.is_a?(Float) || expr.is_a?(String) || expr.is_a?(Symbol) || expr.is_a?(Series) || expr.nil?
129
+ elsif expr.is_a?(Integer) || expr.is_a?(Float) || expr.is_a?(::String) || expr.is_a?(Symbol) || expr.is_a?(Series) || expr.nil?
130
130
  lit(expr)
131
131
  elsif expr.is_a?(Expr)
132
132
  expr
@@ -152,7 +152,7 @@ module Polars
152
152
  if data_type == Unknown
153
153
  return include_unknown
154
154
  end
155
- data_type.is_a?(Symbol) || data_type.is_a?(String) || data_type.is_a?(DataType) || (data_type.is_a?(Class) && data_type < DataType)
155
+ data_type.is_a?(Symbol) || data_type.is_a?(::String) || data_type.is_a?(DataType) || (data_type.is_a?(Class) && data_type < DataType)
156
156
  end
157
157
 
158
158
  def self.map_rb_type_to_dtype(ruby_dtype)
@@ -160,7 +160,7 @@ module Polars
160
160
  Float64
161
161
  elsif ruby_dtype == Integer
162
162
  Int64
163
- elsif ruby_dtype == String
163
+ elsif ruby_dtype == ::String
164
164
  Utf8
165
165
  elsif ruby_dtype == TrueClass || ruby_dtype == FalseClass
166
166
  Boolean
@@ -211,7 +211,7 @@ module Polars
211
211
  projection = nil
212
212
  if columns
213
213
  raise Todo
214
- # if columns.is_a?(String) || columns.is_a?(Symbol)
214
+ # if columns.is_a?(::String) || columns.is_a?(Symbol)
215
215
  # columns = [columns]
216
216
  # elsif is_int_sequence(columns)
217
217
  # projection = columns.to_a
@@ -243,11 +243,11 @@ module Polars
243
243
  end
244
244
 
245
245
  def self.strlike?(value)
246
- value.is_a?(String) || value.is_a?(Symbol)
246
+ value.is_a?(::String) || value.is_a?(Symbol)
247
247
  end
248
248
 
249
249
  def self.pathlike?(value)
250
- value.is_a?(String) || (defined?(Pathname) && value.is_a?(Pathname))
250
+ value.is_a?(::String) || (defined?(Pathname) && value.is_a?(Pathname))
251
251
  end
252
252
 
253
253
  def self._is_iterable_of(val, eltype)
@@ -275,10 +275,10 @@ module Polars
275
275
  end
276
276
 
277
277
  def self.is_str_sequence(val, allow_str: false)
278
- if allow_str == false && val.is_a?(String)
278
+ if allow_str == false && val.is_a?(::String)
279
279
  false
280
280
  else
281
- val.is_a?(::Array) && _is_iterable_of(val, String)
281
+ val.is_a?(::Array) && _is_iterable_of(val, ::String)
282
282
  end
283
283
  end
284
284
 
@@ -289,10 +289,10 @@ module Polars
289
289
  def self.parse_as_expression(input, str_as_lit: false, structify: false)
290
290
  if input.is_a?(Expr)
291
291
  expr = input
292
- elsif input.is_a?(String) && !str_as_lit
292
+ elsif input.is_a?(::String) && !str_as_lit
293
293
  expr = Polars.col(input)
294
294
  structify = false
295
- elsif [Integer, Float, String, Series, ::Date, ::Time, ::DateTime].any? { |cls| input.is_a?(cls) } || input.nil?
295
+ elsif [Integer, Float, ::String, Series, ::Date, ::Time, ::DateTime].any? { |cls| input.is_a?(cls) } || input.nil?
296
296
  expr = Polars.lit(input)
297
297
  structify = false
298
298
  elsif input.is_a?(Array)
@@ -1,4 +1,4 @@
1
1
  module Polars
2
2
  # @private
3
- VERSION = "0.7.0"
3
+ VERSION = "0.8.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.7.0
4
+ version: 0.8.0
5
5
  platform: x86_64-linux
6
6
  authors:
7
7
  - Andrew Kane
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2023-11-18 00:00:00.000000000 Z
11
+ date: 2024-01-10 00:00:00.000000000 Z
12
12
  dependencies: []
13
13
  description:
14
14
  email: andrew@ankane.org
@@ -25,9 +25,9 @@ files:
25
25
  - README.md
26
26
  - lib/polars-df.rb
27
27
  - lib/polars.rb
28
- - lib/polars/3.0/polars.so
29
28
  - lib/polars/3.1/polars.so
30
29
  - lib/polars/3.2/polars.so
30
+ - lib/polars/3.3/polars.so
31
31
  - lib/polars/array_expr.rb
32
32
  - lib/polars/array_name_space.rb
33
33
  - lib/polars/batched_csv_reader.rb
@@ -80,10 +80,10 @@ required_ruby_version: !ruby/object:Gem::Requirement
80
80
  requirements:
81
81
  - - ">="
82
82
  - !ruby/object:Gem::Version
83
- version: '3.0'
83
+ version: '3.1'
84
84
  - - "<"
85
85
  - !ruby/object:Gem::Version
86
- version: 3.3.dev
86
+ version: 3.4.dev
87
87
  required_rubygems_version: !ruby/object:Gem::Requirement
88
88
  requirements:
89
89
  - - ">="