polars-df 0.23.0 → 0.24.0
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.
- checksums.yaml +4 -4
- data/CHANGELOG.md +127 -1
- data/Cargo.lock +72 -58
- data/README.md +31 -27
- data/ext/polars/Cargo.toml +15 -6
- data/ext/polars/src/batched_csv.rs +35 -39
- data/ext/polars/src/c_api/allocator.rs +7 -0
- data/ext/polars/src/c_api/mod.rs +1 -0
- data/ext/polars/src/catalog/unity.rs +123 -101
- data/ext/polars/src/conversion/any_value.rs +13 -17
- data/ext/polars/src/conversion/chunked_array.rs +5 -5
- data/ext/polars/src/conversion/datetime.rs +3 -2
- data/ext/polars/src/conversion/mod.rs +50 -45
- data/ext/polars/src/dataframe/export.rs +13 -13
- data/ext/polars/src/dataframe/general.rs +223 -223
- data/ext/polars/src/dataframe/io.rs +27 -141
- data/ext/polars/src/dataframe/mod.rs +13 -5
- data/ext/polars/src/dataframe/serde.rs +1 -1
- data/ext/polars/src/error.rs +44 -7
- data/ext/polars/src/exceptions.rs +45 -12
- data/ext/polars/src/expr/array.rs +12 -0
- data/ext/polars/src/expr/datatype.rs +2 -2
- data/ext/polars/src/expr/datetime.rs +4 -5
- data/ext/polars/src/expr/general.rs +49 -13
- data/ext/polars/src/expr/list.rs +4 -0
- data/ext/polars/src/expr/meta.rs +8 -3
- data/ext/polars/src/expr/mod.rs +22 -6
- data/ext/polars/src/expr/name.rs +19 -8
- data/ext/polars/src/expr/rolling.rs +50 -1
- data/ext/polars/src/expr/string.rs +0 -1
- data/ext/polars/src/expr/struct.rs +7 -2
- data/ext/polars/src/file.rs +136 -103
- data/ext/polars/src/functions/aggregation.rs +9 -8
- data/ext/polars/src/functions/io.rs +81 -10
- data/ext/polars/src/functions/lazy.rs +95 -21
- data/ext/polars/src/functions/mod.rs +2 -0
- data/ext/polars/src/functions/range.rs +19 -3
- data/ext/polars/src/functions/strings.rs +6 -0
- data/ext/polars/src/functions/utils.rs +6 -0
- data/ext/polars/src/interop/arrow/mod.rs +50 -1
- data/ext/polars/src/interop/arrow/{to_ruby.rs → to_rb.rs} +30 -0
- data/ext/polars/src/interop/arrow/to_rust.rs +43 -0
- data/ext/polars/src/interop/numo/to_numo_df.rs +1 -1
- data/ext/polars/src/interop/numo/to_numo_series.rs +1 -1
- data/ext/polars/src/lazyframe/exitable.rs +39 -0
- data/ext/polars/src/lazyframe/general.rs +340 -236
- data/ext/polars/src/lazyframe/mod.rs +46 -10
- data/ext/polars/src/lazyframe/optflags.rs +5 -4
- data/ext/polars/src/lazyframe/serde.rs +11 -3
- data/ext/polars/src/lazyframe/sink.rs +10 -5
- data/ext/polars/src/lazygroupby.rs +6 -7
- data/ext/polars/src/lib.rs +141 -76
- data/ext/polars/src/map/dataframe.rs +12 -12
- data/ext/polars/src/map/lazy.rs +7 -5
- data/ext/polars/src/map/mod.rs +15 -8
- data/ext/polars/src/map/series.rs +3 -3
- data/ext/polars/src/on_startup.rs +16 -8
- data/ext/polars/src/prelude.rs +1 -0
- data/ext/polars/src/rb_modules.rs +19 -49
- data/ext/polars/src/series/aggregation.rs +79 -140
- data/ext/polars/src/series/arithmetic.rs +16 -22
- data/ext/polars/src/series/comparison.rs +101 -222
- data/ext/polars/src/series/construction.rs +17 -18
- data/ext/polars/src/series/export.rs +1 -1
- data/ext/polars/src/series/general.rs +254 -289
- data/ext/polars/src/series/import.rs +17 -0
- data/ext/polars/src/series/map.rs +178 -160
- data/ext/polars/src/series/mod.rs +28 -12
- data/ext/polars/src/series/scatter.rs +12 -9
- data/ext/polars/src/sql.rs +16 -9
- data/ext/polars/src/testing/frame.rs +31 -0
- data/ext/polars/src/testing/mod.rs +5 -0
- data/ext/polars/src/testing/series.rs +31 -0
- data/ext/polars/src/timeout.rs +105 -0
- data/ext/polars/src/utils.rs +159 -1
- data/lib/polars/array_expr.rb +81 -12
- data/lib/polars/array_name_space.rb +74 -7
- data/lib/polars/batched_csv_reader.rb +21 -21
- data/lib/polars/binary_name_space.rb +1 -1
- data/lib/polars/cat_expr.rb +7 -7
- data/lib/polars/config.rb +1 -1
- data/lib/polars/convert.rb +189 -34
- data/lib/polars/data_frame.rb +1066 -831
- data/lib/polars/data_frame_plot.rb +173 -0
- data/lib/polars/data_type_group.rb +1 -0
- data/lib/polars/data_types.rb +31 -12
- data/lib/polars/date_time_expr.rb +51 -69
- data/lib/polars/date_time_name_space.rb +80 -112
- data/lib/polars/dynamic_group_by.rb +7 -7
- data/lib/polars/exceptions.rb +50 -10
- data/lib/polars/expr.rb +470 -517
- data/lib/polars/functions/aggregation/horizontal.rb +0 -1
- data/lib/polars/functions/aggregation/vertical.rb +2 -3
- data/lib/polars/functions/as_datatype.rb +290 -8
- data/lib/polars/functions/eager.rb +204 -10
- data/lib/polars/functions/escape_regex.rb +21 -0
- data/lib/polars/functions/lazy.rb +409 -169
- data/lib/polars/functions/lit.rb +17 -1
- data/lib/polars/functions/range/int_range.rb +74 -2
- data/lib/polars/functions/range/linear_space.rb +77 -0
- data/lib/polars/functions/range/time_range.rb +1 -1
- data/lib/polars/functions/repeat.rb +3 -12
- data/lib/polars/functions/whenthen.rb +2 -2
- data/lib/polars/group_by.rb +72 -20
- data/lib/polars/iceberg_dataset.rb +1 -6
- data/lib/polars/in_process_query.rb +37 -0
- data/lib/polars/io/cloud.rb +18 -0
- data/lib/polars/io/csv.rb +265 -126
- data/lib/polars/io/database.rb +0 -1
- data/lib/polars/io/delta.rb +15 -7
- data/lib/polars/io/ipc.rb +24 -17
- data/lib/polars/io/ndjson.rb +161 -24
- data/lib/polars/io/parquet.rb +101 -38
- data/lib/polars/lazy_frame.rb +849 -558
- data/lib/polars/lazy_group_by.rb +327 -2
- data/lib/polars/list_expr.rb +94 -16
- data/lib/polars/list_name_space.rb +88 -24
- data/lib/polars/meta_expr.rb +42 -1
- data/lib/polars/name_expr.rb +41 -4
- data/lib/polars/query_opt_flags.rb +198 -2
- data/lib/polars/rolling_group_by.rb +3 -3
- data/lib/polars/schema.rb +21 -3
- data/lib/polars/selector.rb +37 -2
- data/lib/polars/selectors.rb +45 -9
- data/lib/polars/series.rb +1156 -728
- data/lib/polars/series_plot.rb +72 -0
- data/lib/polars/slice.rb +1 -1
- data/lib/polars/sql_context.rb +11 -4
- data/lib/polars/string_expr.rb +59 -68
- data/lib/polars/string_name_space.rb +51 -87
- data/lib/polars/struct_expr.rb +36 -18
- data/lib/polars/testing.rb +24 -273
- data/lib/polars/utils/constants.rb +2 -0
- data/lib/polars/utils/construction/data_frame.rb +410 -0
- data/lib/polars/utils/construction/series.rb +364 -0
- data/lib/polars/utils/construction/utils.rb +9 -0
- data/lib/polars/utils/deprecation.rb +11 -0
- data/lib/polars/utils/serde.rb +8 -3
- data/lib/polars/utils/unstable.rb +19 -0
- data/lib/polars/utils/various.rb +59 -0
- data/lib/polars/utils.rb +46 -47
- data/lib/polars/version.rb +1 -1
- data/lib/polars.rb +47 -1
- metadata +25 -6
- data/ext/polars/src/allocator.rs +0 -13
- data/lib/polars/plot.rb +0 -109
|
@@ -104,49 +104,6 @@ module Polars
|
|
|
104
104
|
Utils.wrap_s(_s).max
|
|
105
105
|
end
|
|
106
106
|
|
|
107
|
-
# Return median as Ruby object.
|
|
108
|
-
#
|
|
109
|
-
# @return [Object]
|
|
110
|
-
#
|
|
111
|
-
# @example
|
|
112
|
-
# date = Polars.datetime_range(
|
|
113
|
-
# DateTime.new(2001, 1, 1), DateTime.new(2001, 1, 3), "1d", eager: true
|
|
114
|
-
# ).alias("datetime")
|
|
115
|
-
# # =>
|
|
116
|
-
# # shape: (3,)
|
|
117
|
-
# # Series: 'datetime' [datetime[ns]]
|
|
118
|
-
# # [
|
|
119
|
-
# # 2001-01-01 00:00:00
|
|
120
|
-
# # 2001-01-02 00:00:00
|
|
121
|
-
# # 2001-01-03 00:00:00
|
|
122
|
-
# # ]
|
|
123
|
-
#
|
|
124
|
-
# @example
|
|
125
|
-
# date.dt.median
|
|
126
|
-
# # => 2001-01-02 00:00:00 UTC
|
|
127
|
-
def median
|
|
128
|
-
_s.median
|
|
129
|
-
end
|
|
130
|
-
|
|
131
|
-
# Return mean as Ruby object.
|
|
132
|
-
#
|
|
133
|
-
# @return [Object]
|
|
134
|
-
#
|
|
135
|
-
# @example
|
|
136
|
-
# s = Polars::Series.new([Date.new(2001, 1, 1), Date.new(2001, 1, 2)])
|
|
137
|
-
# s.dt.mean
|
|
138
|
-
# # => 2001-01-01 12:00:00 UTC
|
|
139
|
-
#
|
|
140
|
-
# @example
|
|
141
|
-
# s = Polars::Series.new(
|
|
142
|
-
# [DateTime.new(2001, 1, 1), DateTime.new(2001, 1, 2), DateTime.new(2001, 1, 3)]
|
|
143
|
-
# )
|
|
144
|
-
# s.dt.mean
|
|
145
|
-
# # => 2001-01-02 00:00:00 UTC
|
|
146
|
-
def mean
|
|
147
|
-
_s.mean
|
|
148
|
-
end
|
|
149
|
-
|
|
150
107
|
# Convert a Date/Time/Datetime column into a String column with the given format.
|
|
151
108
|
#
|
|
152
109
|
# Similar to `cast(Polars::String)`, but this method allows you to customize the
|
|
@@ -173,13 +130,18 @@ module Polars
|
|
|
173
130
|
# # "2020/04/01"
|
|
174
131
|
# # "2020/05/01"
|
|
175
132
|
# # ]
|
|
176
|
-
def to_string(format)
|
|
133
|
+
def to_string(format = nil)
|
|
177
134
|
super
|
|
178
135
|
end
|
|
179
136
|
|
|
180
|
-
#
|
|
137
|
+
# Convert a Date/Time/Datetime column into a String column with the given format.
|
|
181
138
|
#
|
|
182
|
-
#
|
|
139
|
+
# Similar to `cast(Polars::String)`, but this method allows you to customize the
|
|
140
|
+
# formatting of the resulting string.
|
|
141
|
+
#
|
|
142
|
+
# @param format [String]
|
|
143
|
+
# Format to use, refer to the [chrono strftime documentation](https://docs.rs/chrono/latest/chrono/format/strftime/index.html)
|
|
144
|
+
# for specification. Example: `"%y-%m-%d"`.
|
|
183
145
|
#
|
|
184
146
|
# @return [Series]
|
|
185
147
|
#
|
|
@@ -197,7 +159,7 @@ module Polars
|
|
|
197
159
|
# # "2020/04/01"
|
|
198
160
|
# # "2020/05/01"
|
|
199
161
|
# # ]
|
|
200
|
-
def strftime(
|
|
162
|
+
def strftime(format)
|
|
201
163
|
super
|
|
202
164
|
end
|
|
203
165
|
|
|
@@ -300,7 +262,7 @@ module Polars
|
|
|
300
262
|
# @param week_mask [Array]
|
|
301
263
|
# Which days of the week to count. The default is Monday to Friday.
|
|
302
264
|
# If you wanted to count only Monday to Thursday, you would pass
|
|
303
|
-
# `
|
|
265
|
+
# `[true, true, true, true, false, false, false]`.
|
|
304
266
|
#
|
|
305
267
|
# @return [Series]
|
|
306
268
|
#
|
|
@@ -429,6 +391,32 @@ module Polars
|
|
|
429
391
|
super
|
|
430
392
|
end
|
|
431
393
|
|
|
394
|
+
# Extract the number of days in the month from the underlying date representation.
|
|
395
|
+
#
|
|
396
|
+
# Applies to Date and Datetime columns.
|
|
397
|
+
#
|
|
398
|
+
# Returns the number of days in the month.
|
|
399
|
+
# The return value ranges from 28 to 31.
|
|
400
|
+
#
|
|
401
|
+
# @return [Series]
|
|
402
|
+
#
|
|
403
|
+
# @example
|
|
404
|
+
# s = Polars::Series.new(
|
|
405
|
+
# "date", [Date.new(2001, 1, 1), Date.new(2001, 2, 1), Date.new(2000, 2, 1)]
|
|
406
|
+
# )
|
|
407
|
+
# s.dt.days_in_month
|
|
408
|
+
# # =>
|
|
409
|
+
# # shape: (3,)
|
|
410
|
+
# # Series: 'date' [i8]
|
|
411
|
+
# # [
|
|
412
|
+
# # 31
|
|
413
|
+
# # 28
|
|
414
|
+
# # 29
|
|
415
|
+
# # ]
|
|
416
|
+
def days_in_month
|
|
417
|
+
super
|
|
418
|
+
end
|
|
419
|
+
|
|
432
420
|
# Extract the week from the underlying date representation.
|
|
433
421
|
#
|
|
434
422
|
# Applies to Date and Datetime columns.
|
|
@@ -859,43 +847,6 @@ module Polars
|
|
|
859
847
|
super
|
|
860
848
|
end
|
|
861
849
|
|
|
862
|
-
# Set time unit a Series of dtype Datetime or Duration.
|
|
863
|
-
#
|
|
864
|
-
# This does not modify underlying data, and should be used to fix an incorrect
|
|
865
|
-
# time unit.
|
|
866
|
-
#
|
|
867
|
-
# @param time_unit ["ns", "us", "ms"]
|
|
868
|
-
# Time unit for the `Datetime` Series.
|
|
869
|
-
#
|
|
870
|
-
# @return [Series]
|
|
871
|
-
#
|
|
872
|
-
# @example
|
|
873
|
-
# start = DateTime.new(2001, 1, 1)
|
|
874
|
-
# stop = DateTime.new(2001, 1, 3)
|
|
875
|
-
# date = Polars.datetime_range(start, stop, "1d", time_unit: "ns", eager: true).alias("datetime")
|
|
876
|
-
# # =>
|
|
877
|
-
# # shape: (3,)
|
|
878
|
-
# # Series: 'datetime' [datetime[ns]]
|
|
879
|
-
# # [
|
|
880
|
-
# # 2001-01-01 00:00:00
|
|
881
|
-
# # 2001-01-02 00:00:00
|
|
882
|
-
# # 2001-01-03 00:00:00
|
|
883
|
-
# # ]
|
|
884
|
-
#
|
|
885
|
-
# @example
|
|
886
|
-
# date.dt.with_time_unit("us").alias("tu_us")
|
|
887
|
-
# # =>
|
|
888
|
-
# # shape: (3,)
|
|
889
|
-
# # Series: 'tu_us' [datetime[μs]]
|
|
890
|
-
# # [
|
|
891
|
-
# # +32971-04-28 00:00:00
|
|
892
|
-
# # +32974-01-22 00:00:00
|
|
893
|
-
# # +32976-10-18 00:00:00
|
|
894
|
-
# # ]
|
|
895
|
-
def with_time_unit(time_unit)
|
|
896
|
-
super
|
|
897
|
-
end
|
|
898
|
-
|
|
899
850
|
# Cast the underlying data to another time unit. This may lose precision.
|
|
900
851
|
#
|
|
901
852
|
# @param time_unit ["ns", "us", "ms"]
|
|
@@ -1060,21 +1011,11 @@ module Polars
|
|
|
1060
1011
|
super
|
|
1061
1012
|
end
|
|
1062
1013
|
|
|
1063
|
-
# Localize tz-naive Datetime Series to tz-aware Datetime Series.
|
|
1064
|
-
#
|
|
1065
|
-
# This method takes a naive Datetime Series and makes this time zone aware.
|
|
1066
|
-
# It does not move the time to another time zone.
|
|
1067
|
-
#
|
|
1068
|
-
# @param tz [String]
|
|
1069
|
-
# Time zone for the `Datetime` Series.
|
|
1070
|
-
#
|
|
1071
|
-
# @return [Series]
|
|
1072
|
-
def tz_localize(tz)
|
|
1073
|
-
super
|
|
1074
|
-
end
|
|
1075
|
-
|
|
1076
1014
|
# Extract the days from a Duration type.
|
|
1077
1015
|
#
|
|
1016
|
+
# @param fractional [Boolean]
|
|
1017
|
+
# Whether to include the fractional component of the day.
|
|
1018
|
+
#
|
|
1078
1019
|
# @return [Series]
|
|
1079
1020
|
#
|
|
1080
1021
|
# @example
|
|
@@ -1090,13 +1031,15 @@ module Polars
|
|
|
1090
1031
|
# # 31
|
|
1091
1032
|
# # 30
|
|
1092
1033
|
# # ]
|
|
1093
|
-
def total_days
|
|
1034
|
+
def total_days(fractional: false)
|
|
1094
1035
|
super
|
|
1095
1036
|
end
|
|
1096
|
-
alias_method :days, :total_days
|
|
1097
1037
|
|
|
1098
1038
|
# Extract the hours from a Duration type.
|
|
1099
1039
|
#
|
|
1040
|
+
# @param fractional [Boolean]
|
|
1041
|
+
# Whether to include the fractional component of the hour.
|
|
1042
|
+
#
|
|
1100
1043
|
# @return [Series]
|
|
1101
1044
|
#
|
|
1102
1045
|
# @example
|
|
@@ -1122,13 +1065,15 @@ module Polars
|
|
|
1122
1065
|
# # 24
|
|
1123
1066
|
# # 24
|
|
1124
1067
|
# # ]
|
|
1125
|
-
def total_hours
|
|
1068
|
+
def total_hours(fractional: false)
|
|
1126
1069
|
super
|
|
1127
1070
|
end
|
|
1128
|
-
alias_method :hours, :total_hours
|
|
1129
1071
|
|
|
1130
1072
|
# Extract the minutes from a Duration type.
|
|
1131
1073
|
#
|
|
1074
|
+
# @param fractional [Boolean]
|
|
1075
|
+
# Whether to include the fractional component of the minute.
|
|
1076
|
+
#
|
|
1132
1077
|
# @return [Series]
|
|
1133
1078
|
#
|
|
1134
1079
|
# @example
|
|
@@ -1154,13 +1099,15 @@ module Polars
|
|
|
1154
1099
|
# # 1440
|
|
1155
1100
|
# # 1440
|
|
1156
1101
|
# # ]
|
|
1157
|
-
def total_minutes
|
|
1102
|
+
def total_minutes(fractional: false)
|
|
1158
1103
|
super
|
|
1159
1104
|
end
|
|
1160
|
-
alias_method :minutes, :total_minutes
|
|
1161
1105
|
|
|
1162
1106
|
# Extract the seconds from a Duration type.
|
|
1163
1107
|
#
|
|
1108
|
+
# @param fractional [Boolean]
|
|
1109
|
+
# Whether to include the fractional component of the second.
|
|
1110
|
+
#
|
|
1164
1111
|
# @return [Series]
|
|
1165
1112
|
#
|
|
1166
1113
|
# @example
|
|
@@ -1190,13 +1137,15 @@ module Polars
|
|
|
1190
1137
|
# # 60
|
|
1191
1138
|
# # 60
|
|
1192
1139
|
# # ]
|
|
1193
|
-
def total_seconds
|
|
1140
|
+
def total_seconds(fractional: false)
|
|
1194
1141
|
super
|
|
1195
1142
|
end
|
|
1196
|
-
alias_method :seconds, :total_seconds
|
|
1197
1143
|
|
|
1198
1144
|
# Extract the milliseconds from a Duration type.
|
|
1199
1145
|
#
|
|
1146
|
+
# @param fractional [Boolean]
|
|
1147
|
+
# Whether to include the fractional component of the millisecond.
|
|
1148
|
+
#
|
|
1200
1149
|
# @return [Series]
|
|
1201
1150
|
#
|
|
1202
1151
|
# @example
|
|
@@ -1222,13 +1171,15 @@ module Polars
|
|
|
1222
1171
|
# # 1
|
|
1223
1172
|
# # 1
|
|
1224
1173
|
# # ]
|
|
1225
|
-
def total_milliseconds
|
|
1174
|
+
def total_milliseconds(fractional: false)
|
|
1226
1175
|
super
|
|
1227
1176
|
end
|
|
1228
|
-
alias_method :milliseconds, :total_milliseconds
|
|
1229
1177
|
|
|
1230
1178
|
# Extract the microseconds from a Duration type.
|
|
1231
1179
|
#
|
|
1180
|
+
# @param fractional [Boolean]
|
|
1181
|
+
# Whether to include the fractional component of the microsecond.
|
|
1182
|
+
#
|
|
1232
1183
|
# @return [Series]
|
|
1233
1184
|
#
|
|
1234
1185
|
# @example
|
|
@@ -1254,13 +1205,17 @@ module Polars
|
|
|
1254
1205
|
# # 1000
|
|
1255
1206
|
# # 1000
|
|
1256
1207
|
# # ]
|
|
1257
|
-
def total_microseconds
|
|
1208
|
+
def total_microseconds(fractional: false)
|
|
1258
1209
|
super
|
|
1259
1210
|
end
|
|
1260
|
-
alias_method :microseconds, :total_microseconds
|
|
1261
1211
|
|
|
1262
1212
|
# Extract the nanoseconds from a Duration type.
|
|
1263
1213
|
#
|
|
1214
|
+
# @param fractional [Boolean]
|
|
1215
|
+
# Whether to include return the result as a `Float64`.
|
|
1216
|
+
# Because the smallest `TimeUnit` is `'ns'`, the
|
|
1217
|
+
# fractional component will always be zero.
|
|
1218
|
+
#
|
|
1264
1219
|
# @return [Series]
|
|
1265
1220
|
#
|
|
1266
1221
|
# @example
|
|
@@ -1286,10 +1241,9 @@ module Polars
|
|
|
1286
1241
|
# # 1000000
|
|
1287
1242
|
# # 1000000
|
|
1288
1243
|
# # ]
|
|
1289
|
-
def total_nanoseconds
|
|
1244
|
+
def total_nanoseconds(fractional: false)
|
|
1290
1245
|
super
|
|
1291
1246
|
end
|
|
1292
|
-
alias_method :nanoseconds, :total_nanoseconds
|
|
1293
1247
|
|
|
1294
1248
|
# Offset this date by a relative time offset.
|
|
1295
1249
|
#
|
|
@@ -1522,6 +1476,20 @@ module Polars
|
|
|
1522
1476
|
# Unit of time.
|
|
1523
1477
|
#
|
|
1524
1478
|
# @return [Series]
|
|
1479
|
+
#
|
|
1480
|
+
# @example
|
|
1481
|
+
# s = Polars::Series.new(
|
|
1482
|
+
# "dtm",
|
|
1483
|
+
# [DateTime.new(2022, 12, 31, 10, 30, 45), DateTime.new(2023, 7, 5, 23, 59, 59)]
|
|
1484
|
+
# )
|
|
1485
|
+
# s.dt.combine(Time.new(2000, 1, 1, 1, 2, 3.456))
|
|
1486
|
+
# # =>
|
|
1487
|
+
# # shape: (2,)
|
|
1488
|
+
# # Series: 'dtm' [datetime[μs]]
|
|
1489
|
+
# # [
|
|
1490
|
+
# # 2022-12-31 01:02:03.456
|
|
1491
|
+
# # 2023-07-05 01:02:03.456
|
|
1492
|
+
# # ]
|
|
1525
1493
|
def combine(time, time_unit: "us")
|
|
1526
1494
|
super
|
|
1527
1495
|
end
|
|
@@ -10,10 +10,10 @@ module Polars
|
|
|
10
10
|
every,
|
|
11
11
|
period,
|
|
12
12
|
offset,
|
|
13
|
-
truncate,
|
|
14
13
|
include_boundaries,
|
|
15
14
|
closed,
|
|
16
|
-
|
|
15
|
+
label,
|
|
16
|
+
group_by,
|
|
17
17
|
start_by
|
|
18
18
|
)
|
|
19
19
|
period = Utils.parse_as_duration_string(period)
|
|
@@ -25,10 +25,10 @@ module Polars
|
|
|
25
25
|
@every = every
|
|
26
26
|
@period = period
|
|
27
27
|
@offset = offset
|
|
28
|
-
@truncate = truncate
|
|
29
28
|
@include_boundaries = include_boundaries
|
|
30
29
|
@closed = closed
|
|
31
|
-
@
|
|
30
|
+
@label = label
|
|
31
|
+
@group_by = group_by
|
|
32
32
|
@start_by = start_by
|
|
33
33
|
end
|
|
34
34
|
|
|
@@ -39,14 +39,14 @@ module Polars
|
|
|
39
39
|
every: @every,
|
|
40
40
|
period: @period,
|
|
41
41
|
offset: @offset,
|
|
42
|
-
truncate: @truncate,
|
|
43
42
|
include_boundaries: @include_boundaries,
|
|
44
43
|
closed: @closed,
|
|
45
|
-
|
|
44
|
+
label: @label,
|
|
45
|
+
group_by: @group_by,
|
|
46
46
|
start_by: @start_by
|
|
47
47
|
)
|
|
48
48
|
.agg(*aggs, **named_aggs)
|
|
49
|
-
.collect(
|
|
49
|
+
.collect(optimizations: QueryOptFlags.none)
|
|
50
50
|
end
|
|
51
51
|
end
|
|
52
52
|
end
|
data/lib/polars/exceptions.rb
CHANGED
|
@@ -3,13 +3,61 @@ module Polars
|
|
|
3
3
|
# Base class for all Polars errors.
|
|
4
4
|
class Error < StandardError; end
|
|
5
5
|
|
|
6
|
+
# @private
|
|
7
|
+
# Exception raised when a specified column is not found.
|
|
8
|
+
class ColumnNotFoundError < Error; end
|
|
9
|
+
|
|
10
|
+
# @private
|
|
11
|
+
# Exception raised when Polars could not perform an underlying computation.
|
|
12
|
+
class ComputeError < Error; end
|
|
13
|
+
|
|
14
|
+
# @private
|
|
15
|
+
# Exception raised when a column name is duplicated.
|
|
16
|
+
class DuplicateError < Error; end
|
|
17
|
+
|
|
6
18
|
# @private
|
|
7
19
|
# Exception raised when an operation is not allowed (or possible) against a given object or data structure.
|
|
8
20
|
class InvalidOperationError < Error; end
|
|
9
21
|
|
|
10
22
|
# @private
|
|
11
|
-
# Exception raised when an
|
|
12
|
-
class
|
|
23
|
+
# Exception raised when an operation cannot be performed on an empty data structure.
|
|
24
|
+
class NoDataError < Error; end
|
|
25
|
+
|
|
26
|
+
# @private
|
|
27
|
+
# Exception raised when the given index is out of bounds.
|
|
28
|
+
class OutOfBoundsError < Error; end
|
|
29
|
+
|
|
30
|
+
# @private
|
|
31
|
+
# Exception raised when an unexpected state causes a panic in the underlying Rust library.
|
|
32
|
+
class PanicException < Error; end
|
|
33
|
+
|
|
34
|
+
# @private
|
|
35
|
+
# Exception raised when an unexpected schema mismatch causes an error.
|
|
36
|
+
class SchemaError < Error; end
|
|
37
|
+
|
|
38
|
+
# @private
|
|
39
|
+
# Exception raised when a specified schema field is not found.
|
|
40
|
+
class SchemaFieldNotFoundError < Error; end
|
|
41
|
+
|
|
42
|
+
# @private
|
|
43
|
+
# Exception raised when trying to perform operations on data structures with incompatible shapes.
|
|
44
|
+
class ShapeError < Error; end
|
|
45
|
+
|
|
46
|
+
# @private
|
|
47
|
+
# Exception raised when an error occurs in the SQL interface.
|
|
48
|
+
class SQLInterfaceError < Error; end
|
|
49
|
+
|
|
50
|
+
# @private
|
|
51
|
+
# Exception raised from the SQL interface when encountering invalid syntax.
|
|
52
|
+
class SQLSyntaxError < Error; end
|
|
53
|
+
|
|
54
|
+
# @private
|
|
55
|
+
# Exception raised when string caches come from different sources.
|
|
56
|
+
class StringCacheMismatchError < Error; end
|
|
57
|
+
|
|
58
|
+
# @private
|
|
59
|
+
# Exception raised when a specified Struct field is not found.
|
|
60
|
+
class StructFieldNotFoundError < Error; end
|
|
13
61
|
|
|
14
62
|
# @private
|
|
15
63
|
# Exception raised when the number of returned rows does not match expectation.
|
|
@@ -23,14 +71,6 @@ module Polars
|
|
|
23
71
|
# Exception raised when more rows than expected are returned.
|
|
24
72
|
class TooManyRowsReturned < RowsException; end
|
|
25
73
|
|
|
26
|
-
# @private
|
|
27
|
-
# Exception raised when Polars could not perform an underlying computation.
|
|
28
|
-
class ComputeError < Error; end
|
|
29
|
-
|
|
30
|
-
# @private
|
|
31
|
-
# Exception raised when a column name is duplicated.
|
|
32
|
-
class DuplicateError < Error; end
|
|
33
|
-
|
|
34
74
|
# @private
|
|
35
75
|
class AssertionError < Error; end
|
|
36
76
|
|