polars-df 0.1.0 → 0.1.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +4 -0
- data/Cargo.lock +1946 -0
- data/Cargo.toml +5 -0
- data/ext/polars/Cargo.toml +31 -1
- data/ext/polars/src/conversion.rs +237 -43
- data/ext/polars/src/dataframe.rs +278 -1
- data/ext/polars/src/lazy/dataframe.rs +304 -10
- data/ext/polars/src/lazy/dsl.rs +1096 -5
- data/ext/polars/src/lazy/meta.rs +41 -0
- data/ext/polars/src/lazy/mod.rs +1 -0
- data/ext/polars/src/lib.rs +313 -0
- data/ext/polars/src/series.rs +168 -5
- data/lib/polars/cat_expr.rb +13 -0
- data/lib/polars/data_frame.rb +312 -7
- data/lib/polars/date_time_expr.rb +143 -0
- data/lib/polars/expr.rb +488 -0
- data/lib/polars/lazy_frame.rb +184 -6
- data/lib/polars/lazy_functions.rb +4 -0
- data/lib/polars/list_expr.rb +108 -0
- data/lib/polars/meta_expr.rb +33 -0
- data/lib/polars/series.rb +513 -11
- data/lib/polars/string_expr.rb +117 -0
- data/lib/polars/struct_expr.rb +27 -0
- data/lib/polars/utils.rb +27 -0
- data/lib/polars/version.rb +1 -1
- data/lib/polars.rb +6 -1
- metadata +10 -2
@@ -0,0 +1,41 @@
|
|
1
|
+
use crate::{RbExpr, RbPolarsErr, RbResult};
|
2
|
+
|
3
|
+
impl RbExpr {
|
4
|
+
pub fn meta_pop(&self) -> Vec<RbExpr> {
|
5
|
+
self.inner
|
6
|
+
.clone()
|
7
|
+
.meta()
|
8
|
+
.pop()
|
9
|
+
.into_iter()
|
10
|
+
.map(|v| RbExpr::from(v))
|
11
|
+
.collect()
|
12
|
+
}
|
13
|
+
|
14
|
+
pub fn meta_eq(&self, other: &RbExpr) -> bool {
|
15
|
+
self.inner == other.inner
|
16
|
+
}
|
17
|
+
|
18
|
+
pub fn meta_roots(&self) -> Vec<String> {
|
19
|
+
self.inner
|
20
|
+
.clone()
|
21
|
+
.meta()
|
22
|
+
.root_names()
|
23
|
+
.iter()
|
24
|
+
.map(|name| name.to_string())
|
25
|
+
.collect()
|
26
|
+
}
|
27
|
+
|
28
|
+
pub fn meta_output_name(&self) -> RbResult<String> {
|
29
|
+
let name = self
|
30
|
+
.inner
|
31
|
+
.clone()
|
32
|
+
.meta()
|
33
|
+
.output_name()
|
34
|
+
.map_err(RbPolarsErr::from)?;
|
35
|
+
Ok(name.to_string())
|
36
|
+
}
|
37
|
+
|
38
|
+
pub fn meta_undo_aliases(&self) -> RbExpr {
|
39
|
+
self.inner.clone().meta().undo_aliases().into()
|
40
|
+
}
|
41
|
+
}
|
data/ext/polars/src/lazy/mod.rs
CHANGED
data/ext/polars/src/lib.rs
CHANGED
@@ -42,29 +42,75 @@ fn init() -> RbResult<()> {
|
|
42
42
|
class.define_singleton_method("read_hash", function!(RbDataFrame::read_hash, 1))?;
|
43
43
|
class.define_singleton_method("read_json", function!(RbDataFrame::read_json, 1))?;
|
44
44
|
class.define_singleton_method("read_ndjson", function!(RbDataFrame::read_ndjson, 1))?;
|
45
|
+
class.define_method("estimated_size", method!(RbDataFrame::estimated_size, 0))?;
|
45
46
|
class.define_method("write_json", method!(RbDataFrame::write_json, 3))?;
|
46
47
|
class.define_method("write_ndjson", method!(RbDataFrame::write_ndjson, 1))?;
|
47
48
|
class.define_method("write_csv", method!(RbDataFrame::write_csv, 10))?;
|
48
49
|
class.define_method("write_parquet", method!(RbDataFrame::write_parquet, 5))?;
|
49
50
|
class.define_method("rechunk", method!(RbDataFrame::rechunk, 0))?;
|
50
51
|
class.define_method("to_s", method!(RbDataFrame::to_s, 0))?;
|
52
|
+
class.define_method("get_columns", method!(RbDataFrame::get_columns, 0))?;
|
51
53
|
class.define_method("columns", method!(RbDataFrame::columns, 0))?;
|
54
|
+
class.define_method(
|
55
|
+
"set_column_names",
|
56
|
+
method!(RbDataFrame::set_column_names, 1),
|
57
|
+
)?;
|
52
58
|
class.define_method("dtypes", method!(RbDataFrame::dtypes, 0))?;
|
59
|
+
class.define_method("n_chunks", method!(RbDataFrame::n_chunks, 0))?;
|
53
60
|
class.define_method("shape", method!(RbDataFrame::shape, 0))?;
|
54
61
|
class.define_method("height", method!(RbDataFrame::height, 0))?;
|
55
62
|
class.define_method("width", method!(RbDataFrame::width, 0))?;
|
56
63
|
class.define_method("select_at_idx", method!(RbDataFrame::select_at_idx, 1))?;
|
57
64
|
class.define_method("column", method!(RbDataFrame::column, 1))?;
|
65
|
+
class.define_method("select", method!(RbDataFrame::select, 1))?;
|
66
|
+
class.define_method("take", method!(RbDataFrame::take, 1))?;
|
67
|
+
class.define_method(
|
68
|
+
"take_with_series",
|
69
|
+
method!(RbDataFrame::take_with_series, 1),
|
70
|
+
)?;
|
58
71
|
class.define_method("sort", method!(RbDataFrame::sort, 3))?;
|
72
|
+
class.define_method("replace", method!(RbDataFrame::replace, 2))?;
|
73
|
+
class.define_method("replace_at_idx", method!(RbDataFrame::replace_at_idx, 2))?;
|
74
|
+
class.define_method("insert_at_idx", method!(RbDataFrame::insert_at_idx, 2))?;
|
75
|
+
class.define_method("slice", method!(RbDataFrame::slice, 2))?;
|
59
76
|
class.define_method("head", method!(RbDataFrame::head, 1))?;
|
60
77
|
class.define_method("tail", method!(RbDataFrame::tail, 1))?;
|
78
|
+
class.define_method("is_unique", method!(RbDataFrame::is_unique, 0))?;
|
79
|
+
class.define_method("is_duplicated", method!(RbDataFrame::is_duplicated, 0))?;
|
61
80
|
class.define_method("frame_equal", method!(RbDataFrame::frame_equal, 2))?;
|
81
|
+
class.define_method("with_row_count", method!(RbDataFrame::with_row_count, 2))?;
|
82
|
+
class.define_method("_clone", method!(RbDataFrame::clone, 0))?;
|
83
|
+
class.define_method("melt", method!(RbDataFrame::melt, 4))?;
|
84
|
+
class.define_method("partition_by", method!(RbDataFrame::partition_by, 2))?;
|
85
|
+
class.define_method("shift", method!(RbDataFrame::shift, 1))?;
|
86
|
+
class.define_method("unique", method!(RbDataFrame::unique, 3))?;
|
62
87
|
class.define_method("lazy", method!(RbDataFrame::lazy, 0))?;
|
88
|
+
class.define_method("max", method!(RbDataFrame::max, 0))?;
|
89
|
+
class.define_method("min", method!(RbDataFrame::min, 0))?;
|
90
|
+
class.define_method("sum", method!(RbDataFrame::sum, 0))?;
|
63
91
|
class.define_method("mean", method!(RbDataFrame::mean, 0))?;
|
92
|
+
class.define_method("std", method!(RbDataFrame::std, 1))?;
|
93
|
+
class.define_method("var", method!(RbDataFrame::var, 1))?;
|
94
|
+
class.define_method("median", method!(RbDataFrame::median, 0))?;
|
95
|
+
class.define_method("hmean", method!(RbDataFrame::hmean, 1))?;
|
96
|
+
class.define_method("hmax", method!(RbDataFrame::hmax, 0))?;
|
97
|
+
class.define_method("hmin", method!(RbDataFrame::hmin, 0))?;
|
98
|
+
class.define_method("hsum", method!(RbDataFrame::hsum, 1))?;
|
99
|
+
class.define_method("quantile", method!(RbDataFrame::quantile, 2))?;
|
100
|
+
class.define_method("to_dummies", method!(RbDataFrame::to_dummies, 1))?;
|
64
101
|
class.define_method("null_count", method!(RbDataFrame::null_count, 0))?;
|
102
|
+
class.define_method("shrink_to_fit", method!(RbDataFrame::shrink_to_fit, 0))?;
|
103
|
+
class.define_method("transpose", method!(RbDataFrame::transpose, 2))?;
|
104
|
+
class.define_method("upsample", method!(RbDataFrame::upsample, 5))?;
|
105
|
+
class.define_method("unnest", method!(RbDataFrame::unnest, 1))?;
|
65
106
|
|
66
107
|
let class = module.define_class("RbExpr", Default::default())?;
|
108
|
+
class.define_method("+", method!(RbExpr::add, 1))?;
|
109
|
+
class.define_method("-", method!(RbExpr::sub, 1))?;
|
67
110
|
class.define_method("*", method!(RbExpr::mul, 1))?;
|
111
|
+
class.define_method("/", method!(RbExpr::truediv, 1))?;
|
112
|
+
class.define_method("%", method!(RbExpr::_mod, 1))?;
|
113
|
+
class.define_method("floordiv", method!(RbExpr::floordiv, 1))?;
|
68
114
|
class.define_method("to_str", method!(RbExpr::to_str, 0))?;
|
69
115
|
class.define_method("eq", method!(RbExpr::eq, 1))?;
|
70
116
|
class.define_method("neq", method!(RbExpr::neq, 1))?;
|
@@ -76,20 +122,43 @@ fn init() -> RbResult<()> {
|
|
76
122
|
class.define_method("is_not", method!(RbExpr::is_not, 0))?;
|
77
123
|
class.define_method("is_null", method!(RbExpr::is_null, 0))?;
|
78
124
|
class.define_method("is_not_null", method!(RbExpr::is_not_null, 0))?;
|
125
|
+
class.define_method("is_infinite", method!(RbExpr::is_infinite, 0))?;
|
126
|
+
class.define_method("is_finite", method!(RbExpr::is_finite, 0))?;
|
127
|
+
class.define_method("is_nan", method!(RbExpr::is_nan, 0))?;
|
128
|
+
class.define_method("is_not_nan", method!(RbExpr::is_not_nan, 0))?;
|
79
129
|
class.define_method("min", method!(RbExpr::min, 0))?;
|
80
130
|
class.define_method("max", method!(RbExpr::max, 0))?;
|
131
|
+
class.define_method("nan_max", method!(RbExpr::nan_max, 0))?;
|
132
|
+
class.define_method("nan_min", method!(RbExpr::nan_min, 0))?;
|
81
133
|
class.define_method("mean", method!(RbExpr::mean, 0))?;
|
82
134
|
class.define_method("median", method!(RbExpr::median, 0))?;
|
83
135
|
class.define_method("sum", method!(RbExpr::sum, 0))?;
|
84
136
|
class.define_method("n_unique", method!(RbExpr::n_unique, 0))?;
|
137
|
+
class.define_method("arg_unique", method!(RbExpr::arg_unique, 0))?;
|
85
138
|
class.define_method("unique", method!(RbExpr::unique, 0))?;
|
86
139
|
class.define_method("unique_stable", method!(RbExpr::unique_stable, 0))?;
|
87
140
|
class.define_method("first", method!(RbExpr::first, 0))?;
|
88
141
|
class.define_method("last", method!(RbExpr::last, 0))?;
|
89
142
|
class.define_method("list", method!(RbExpr::list, 0))?;
|
143
|
+
class.define_method("quantile", method!(RbExpr::quantile, 2))?;
|
144
|
+
class.define_method("agg_groups", method!(RbExpr::agg_groups, 0))?;
|
90
145
|
class.define_method("count", method!(RbExpr::count, 0))?;
|
146
|
+
class.define_method("value_counts", method!(RbExpr::value_counts, 2))?;
|
147
|
+
class.define_method("unique_counts", method!(RbExpr::unique_counts, 0))?;
|
148
|
+
class.define_method("null_count", method!(RbExpr::null_count, 0))?;
|
149
|
+
class.define_method("cast", method!(RbExpr::cast, 2))?;
|
91
150
|
class.define_method("sort_with", method!(RbExpr::sort_with, 2))?;
|
151
|
+
class.define_method("arg_sort", method!(RbExpr::arg_sort, 2))?;
|
152
|
+
class.define_method("top_k", method!(RbExpr::top_k, 2))?;
|
153
|
+
class.define_method("arg_max", method!(RbExpr::arg_max, 0))?;
|
154
|
+
class.define_method("arg_min", method!(RbExpr::arg_min, 0))?;
|
155
|
+
class.define_method("search_sorted", method!(RbExpr::search_sorted, 1))?;
|
156
|
+
class.define_method("take", method!(RbExpr::take, 1))?;
|
92
157
|
class.define_method("sort_by", method!(RbExpr::sort_by, 2))?;
|
158
|
+
class.define_method("backward_fill", method!(RbExpr::backward_fill, 1))?;
|
159
|
+
class.define_method("forward_fill", method!(RbExpr::forward_fill, 1))?;
|
160
|
+
class.define_method("shift", method!(RbExpr::shift, 1))?;
|
161
|
+
class.define_method("shift_and_fill", method!(RbExpr::shift_and_fill, 2))?;
|
93
162
|
class.define_method("fill_null", method!(RbExpr::fill_null, 1))?;
|
94
163
|
class.define_method(
|
95
164
|
"fill_null_with_strategy",
|
@@ -102,18 +171,196 @@ fn init() -> RbResult<()> {
|
|
102
171
|
class.define_method("reverse", method!(RbExpr::reverse, 0))?;
|
103
172
|
class.define_method("std", method!(RbExpr::std, 1))?;
|
104
173
|
class.define_method("var", method!(RbExpr::var, 1))?;
|
174
|
+
class.define_method("is_unique", method!(RbExpr::is_unique, 0))?;
|
175
|
+
class.define_method("is_first", method!(RbExpr::is_first, 0))?;
|
176
|
+
class.define_method("explode", method!(RbExpr::explode, 0))?;
|
177
|
+
class.define_method("take_every", method!(RbExpr::take_every, 1))?;
|
105
178
|
class.define_method("tail", method!(RbExpr::tail, 1))?;
|
106
179
|
class.define_method("head", method!(RbExpr::head, 1))?;
|
180
|
+
class.define_method("slice", method!(RbExpr::slice, 2))?;
|
181
|
+
class.define_method("append", method!(RbExpr::append, 2))?;
|
182
|
+
class.define_method("rechunk", method!(RbExpr::rechunk, 0))?;
|
183
|
+
class.define_method("round", method!(RbExpr::round, 1))?;
|
184
|
+
class.define_method("floor", method!(RbExpr::floor, 0))?;
|
185
|
+
class.define_method("ceil", method!(RbExpr::ceil, 0))?;
|
186
|
+
class.define_method("clip", method!(RbExpr::clip, 2))?;
|
187
|
+
class.define_method("clip_min", method!(RbExpr::clip_min, 1))?;
|
188
|
+
class.define_method("clip_max", method!(RbExpr::clip_max, 1))?;
|
189
|
+
class.define_method("abs", method!(RbExpr::abs, 0))?;
|
190
|
+
class.define_method("sin", method!(RbExpr::sin, 0))?;
|
191
|
+
class.define_method("cos", method!(RbExpr::cos, 0))?;
|
192
|
+
class.define_method("tan", method!(RbExpr::tan, 0))?;
|
193
|
+
class.define_method("arcsin", method!(RbExpr::arcsin, 0))?;
|
194
|
+
class.define_method("arccos", method!(RbExpr::arccos, 0))?;
|
195
|
+
class.define_method("arctan", method!(RbExpr::arctan, 0))?;
|
196
|
+
class.define_method("sinh", method!(RbExpr::sinh, 0))?;
|
197
|
+
class.define_method("cosh", method!(RbExpr::cosh, 0))?;
|
198
|
+
class.define_method("tanh", method!(RbExpr::tanh, 0))?;
|
199
|
+
class.define_method("arcsinh", method!(RbExpr::arcsinh, 0))?;
|
200
|
+
class.define_method("arccosh", method!(RbExpr::arccosh, 0))?;
|
201
|
+
class.define_method("arctanh", method!(RbExpr::arctanh, 0))?;
|
202
|
+
class.define_method("sign", method!(RbExpr::sign, 0))?;
|
203
|
+
class.define_method("is_duplicated", method!(RbExpr::is_duplicated, 0))?;
|
107
204
|
class.define_method("over", method!(RbExpr::over, 1))?;
|
108
205
|
class.define_method("_and", method!(RbExpr::_and, 1))?;
|
109
206
|
class.define_method("_xor", method!(RbExpr::_xor, 1))?;
|
110
207
|
class.define_method("_or", method!(RbExpr::_or, 1))?;
|
208
|
+
class.define_method("is_in", method!(RbExpr::is_in, 1))?;
|
209
|
+
class.define_method("repeat_by", method!(RbExpr::repeat_by, 1))?;
|
210
|
+
class.define_method("pow", method!(RbExpr::pow, 1))?;
|
211
|
+
class.define_method("cumsum", method!(RbExpr::cumsum, 1))?;
|
212
|
+
class.define_method("cummax", method!(RbExpr::cummax, 1))?;
|
213
|
+
class.define_method("cummin", method!(RbExpr::cummin, 1))?;
|
214
|
+
class.define_method("cumprod", method!(RbExpr::cumprod, 1))?;
|
111
215
|
class.define_method("product", method!(RbExpr::product, 0))?;
|
216
|
+
class.define_method("shrink_dtype", method!(RbExpr::shrink_dtype, 0))?;
|
217
|
+
class.define_method("str_parse_date", method!(RbExpr::str_parse_date, 3))?;
|
218
|
+
class.define_method("str_parse_datetime", method!(RbExpr::str_parse_datetime, 3))?;
|
219
|
+
class.define_method("str_parse_time", method!(RbExpr::str_parse_time, 3))?;
|
220
|
+
class.define_method("str_strip", method!(RbExpr::str_strip, 1))?;
|
221
|
+
class.define_method("str_rstrip", method!(RbExpr::str_rstrip, 1))?;
|
222
|
+
class.define_method("str_lstrip", method!(RbExpr::str_lstrip, 1))?;
|
223
|
+
class.define_method("str_slice", method!(RbExpr::str_slice, 2))?;
|
224
|
+
class.define_method("str_to_uppercase", method!(RbExpr::str_to_uppercase, 0))?;
|
225
|
+
class.define_method("str_to_lowercase", method!(RbExpr::str_to_lowercase, 0))?;
|
112
226
|
class.define_method("str_lengths", method!(RbExpr::str_lengths, 0))?;
|
227
|
+
class.define_method("str_n_chars", method!(RbExpr::str_n_chars, 0))?;
|
228
|
+
class.define_method("str_replace", method!(RbExpr::str_replace, 3))?;
|
229
|
+
class.define_method("str_replace_all", method!(RbExpr::str_replace_all, 3))?;
|
230
|
+
class.define_method("str_zfill", method!(RbExpr::str_zfill, 1))?;
|
231
|
+
class.define_method("str_ljust", method!(RbExpr::str_ljust, 2))?;
|
232
|
+
class.define_method("str_rjust", method!(RbExpr::str_rjust, 2))?;
|
113
233
|
class.define_method("str_contains", method!(RbExpr::str_contains, 2))?;
|
234
|
+
class.define_method("str_ends_with", method!(RbExpr::str_ends_with, 1))?;
|
235
|
+
class.define_method("str_starts_with", method!(RbExpr::str_starts_with, 1))?;
|
236
|
+
class.define_method("str_extract", method!(RbExpr::str_extract, 2))?;
|
237
|
+
class.define_method("str_extract_all", method!(RbExpr::str_extract_all, 1))?;
|
238
|
+
class.define_method("count_match", method!(RbExpr::count_match, 1))?;
|
239
|
+
class.define_method("strftime", method!(RbExpr::strftime, 1))?;
|
240
|
+
class.define_method("str_split", method!(RbExpr::str_split, 1))?;
|
241
|
+
class.define_method(
|
242
|
+
"str_split_inclusive",
|
243
|
+
method!(RbExpr::str_split_inclusive, 1),
|
244
|
+
)?;
|
245
|
+
class.define_method("str_split_exact", method!(RbExpr::str_split_exact, 2))?;
|
246
|
+
class.define_method(
|
247
|
+
"str_split_exact_inclusive",
|
248
|
+
method!(RbExpr::str_split_exact_inclusive, 2),
|
249
|
+
)?;
|
250
|
+
class.define_method("str_splitn", method!(RbExpr::str_splitn, 2))?;
|
251
|
+
class.define_method("arr_lengths", method!(RbExpr::arr_lengths, 0))?;
|
252
|
+
class.define_method("arr_contains", method!(RbExpr::arr_contains, 1))?;
|
253
|
+
class.define_method("year", method!(RbExpr::year, 0))?;
|
254
|
+
class.define_method("iso_year", method!(RbExpr::iso_year, 0))?;
|
255
|
+
class.define_method("quarter", method!(RbExpr::quarter, 0))?;
|
256
|
+
class.define_method("month", method!(RbExpr::month, 0))?;
|
257
|
+
class.define_method("week", method!(RbExpr::week, 0))?;
|
258
|
+
class.define_method("weekday", method!(RbExpr::weekday, 0))?;
|
259
|
+
class.define_method("day", method!(RbExpr::day, 0))?;
|
260
|
+
class.define_method("ordinal_day", method!(RbExpr::ordinal_day, 0))?;
|
261
|
+
class.define_method("hour", method!(RbExpr::hour, 0))?;
|
262
|
+
class.define_method("minute", method!(RbExpr::minute, 0))?;
|
263
|
+
class.define_method("second", method!(RbExpr::second, 0))?;
|
264
|
+
class.define_method("millisecond", method!(RbExpr::millisecond, 0))?;
|
265
|
+
class.define_method("microsecond", method!(RbExpr::microsecond, 0))?;
|
266
|
+
class.define_method("nanosecond", method!(RbExpr::nanosecond, 0))?;
|
267
|
+
class.define_method("duration_days", method!(RbExpr::duration_days, 0))?;
|
268
|
+
class.define_method("duration_hours", method!(RbExpr::duration_hours, 0))?;
|
269
|
+
class.define_method("duration_minutes", method!(RbExpr::duration_minutes, 0))?;
|
270
|
+
class.define_method("duration_seconds", method!(RbExpr::duration_seconds, 0))?;
|
271
|
+
class.define_method(
|
272
|
+
"duration_nanoseconds",
|
273
|
+
method!(RbExpr::duration_nanoseconds, 0),
|
274
|
+
)?;
|
275
|
+
class.define_method(
|
276
|
+
"duration_microseconds",
|
277
|
+
method!(RbExpr::duration_microseconds, 0),
|
278
|
+
)?;
|
279
|
+
class.define_method(
|
280
|
+
"duration_milliseconds",
|
281
|
+
method!(RbExpr::duration_milliseconds, 0),
|
282
|
+
)?;
|
283
|
+
class.define_method("timestamp", method!(RbExpr::timestamp, 1))?;
|
284
|
+
class.define_method("dt_offset_by", method!(RbExpr::dt_offset_by, 1))?;
|
285
|
+
class.define_method("dt_epoch_seconds", method!(RbExpr::dt_epoch_seconds, 0))?;
|
286
|
+
class.define_method("dt_with_time_unit", method!(RbExpr::dt_with_time_unit, 1))?;
|
287
|
+
class.define_method("dt_with_time_zone", method!(RbExpr::dt_with_time_zone, 1))?;
|
288
|
+
class.define_method("dt_cast_time_unit", method!(RbExpr::dt_cast_time_unit, 1))?;
|
289
|
+
class.define_method("dt_cast_time_zone", method!(RbExpr::dt_cast_time_zone, 1))?;
|
290
|
+
class.define_method("dt_tz_localize", method!(RbExpr::dt_tz_localize, 1))?;
|
291
|
+
class.define_method("dt_truncate", method!(RbExpr::dt_truncate, 2))?;
|
292
|
+
class.define_method("dt_round", method!(RbExpr::dt_round, 2))?;
|
293
|
+
class.define_method("mode", method!(RbExpr::mode, 0))?;
|
294
|
+
class.define_method("keep_name", method!(RbExpr::keep_name, 0))?;
|
114
295
|
class.define_method("prefix", method!(RbExpr::prefix, 1))?;
|
115
296
|
class.define_method("suffix", method!(RbExpr::suffix, 1))?;
|
116
297
|
class.define_method("interpolate", method!(RbExpr::interpolate, 0))?;
|
298
|
+
class.define_method("rolling_sum", method!(RbExpr::rolling_sum, 6))?;
|
299
|
+
class.define_method("rolling_min", method!(RbExpr::rolling_min, 6))?;
|
300
|
+
class.define_method("rolling_max", method!(RbExpr::rolling_max, 6))?;
|
301
|
+
class.define_method("rolling_mean", method!(RbExpr::rolling_mean, 6))?;
|
302
|
+
class.define_method("rolling_std", method!(RbExpr::rolling_std, 6))?;
|
303
|
+
class.define_method("rolling_var", method!(RbExpr::rolling_var, 6))?;
|
304
|
+
class.define_method("rolling_median", method!(RbExpr::rolling_median, 6))?;
|
305
|
+
class.define_method("rolling_quantile", method!(RbExpr::rolling_quantile, 8))?;
|
306
|
+
class.define_method("rolling_skew", method!(RbExpr::rolling_skew, 2))?;
|
307
|
+
class.define_method("lower_bound", method!(RbExpr::lower_bound, 0))?;
|
308
|
+
class.define_method("upper_bound", method!(RbExpr::upper_bound, 0))?;
|
309
|
+
class.define_method("lst_max", method!(RbExpr::lst_max, 0))?;
|
310
|
+
class.define_method("lst_min", method!(RbExpr::lst_min, 0))?;
|
311
|
+
class.define_method("lst_sum", method!(RbExpr::lst_sum, 0))?;
|
312
|
+
class.define_method("lst_mean", method!(RbExpr::lst_mean, 0))?;
|
313
|
+
class.define_method("lst_sort", method!(RbExpr::lst_sort, 1))?;
|
314
|
+
class.define_method("lst_reverse", method!(RbExpr::lst_reverse, 0))?;
|
315
|
+
class.define_method("lst_unique", method!(RbExpr::lst_unique, 0))?;
|
316
|
+
class.define_method("lst_get", method!(RbExpr::lst_get, 1))?;
|
317
|
+
class.define_method("lst_join", method!(RbExpr::lst_join, 1))?;
|
318
|
+
class.define_method("lst_arg_min", method!(RbExpr::lst_arg_min, 0))?;
|
319
|
+
class.define_method("lst_arg_max", method!(RbExpr::lst_arg_max, 0))?;
|
320
|
+
class.define_method("lst_diff", method!(RbExpr::lst_diff, 2))?;
|
321
|
+
class.define_method("lst_shift", method!(RbExpr::lst_shift, 1))?;
|
322
|
+
class.define_method("lst_slice", method!(RbExpr::lst_slice, 2))?;
|
323
|
+
class.define_method("lst_eval", method!(RbExpr::lst_eval, 2))?;
|
324
|
+
class.define_method("cumulative_eval", method!(RbExpr::cumulative_eval, 3))?;
|
325
|
+
class.define_method("rank", method!(RbExpr::rank, 2))?;
|
326
|
+
class.define_method("diff", method!(RbExpr::diff, 2))?;
|
327
|
+
class.define_method("pct_change", method!(RbExpr::pct_change, 1))?;
|
328
|
+
class.define_method("skew", method!(RbExpr::skew, 1))?;
|
329
|
+
class.define_method("kurtosis", method!(RbExpr::kurtosis, 2))?;
|
330
|
+
class.define_method("str_concat", method!(RbExpr::str_concat, 1))?;
|
331
|
+
class.define_method("cat_set_ordering", method!(RbExpr::cat_set_ordering, 1))?;
|
332
|
+
class.define_method("reshape", method!(RbExpr::reshape, 1))?;
|
333
|
+
class.define_method("cumcount", method!(RbExpr::cumcount, 1))?;
|
334
|
+
class.define_method("to_physical", method!(RbExpr::to_physical, 0))?;
|
335
|
+
class.define_method("shuffle", method!(RbExpr::shuffle, 1))?;
|
336
|
+
class.define_method("sample_n", method!(RbExpr::sample_n, 4))?;
|
337
|
+
class.define_method("sample_frac", method!(RbExpr::sample_frac, 4))?;
|
338
|
+
class.define_method("ewm_mean", method!(RbExpr::ewm_mean, 3))?;
|
339
|
+
class.define_method("ewm_std", method!(RbExpr::ewm_std, 4))?;
|
340
|
+
class.define_method("ewm_var", method!(RbExpr::ewm_var, 4))?;
|
341
|
+
class.define_method("any", method!(RbExpr::any, 0))?;
|
342
|
+
class.define_method("all", method!(RbExpr::all, 0))?;
|
343
|
+
class.define_method(
|
344
|
+
"struct_field_by_name",
|
345
|
+
method!(RbExpr::struct_field_by_name, 1),
|
346
|
+
)?;
|
347
|
+
class.define_method(
|
348
|
+
"struct_field_by_index",
|
349
|
+
method!(RbExpr::struct_field_by_index, 1),
|
350
|
+
)?;
|
351
|
+
class.define_method(
|
352
|
+
"struct_rename_fields",
|
353
|
+
method!(RbExpr::struct_rename_fields, 1),
|
354
|
+
)?;
|
355
|
+
class.define_method("log", method!(RbExpr::log, 1))?;
|
356
|
+
class.define_method("exp", method!(RbExpr::exp, 0))?;
|
357
|
+
|
358
|
+
// meta
|
359
|
+
class.define_method("meta_pop", method!(RbExpr::meta_pop, 0))?;
|
360
|
+
class.define_method("meta_eq", method!(RbExpr::meta_eq, 1))?;
|
361
|
+
class.define_method("meta_roots", method!(RbExpr::meta_roots, 0))?;
|
362
|
+
class.define_method("meta_output_name", method!(RbExpr::meta_output_name, 0))?;
|
363
|
+
class.define_method("meta_undo_aliases", method!(RbExpr::meta_undo_aliases, 0))?;
|
117
364
|
|
118
365
|
// maybe add to different class
|
119
366
|
class.define_singleton_method("col", function!(crate::lazy::dsl::col, 1))?;
|
@@ -122,19 +369,60 @@ fn init() -> RbResult<()> {
|
|
122
369
|
class.define_singleton_method("when", function!(crate::lazy::dsl::when, 1))?;
|
123
370
|
|
124
371
|
let class = module.define_class("RbLazyFrame", Default::default())?;
|
372
|
+
class.define_method("write_json", method!(RbLazyFrame::write_json, 1))?;
|
373
|
+
class.define_method("describe_plan", method!(RbLazyFrame::describe_plan, 0))?;
|
374
|
+
class.define_method(
|
375
|
+
"describe_optimized_plan",
|
376
|
+
method!(RbLazyFrame::describe_optimized_plan, 0),
|
377
|
+
)?;
|
125
378
|
class.define_method(
|
126
379
|
"optimization_toggle",
|
127
380
|
method!(RbLazyFrame::optimization_toggle, 7),
|
128
381
|
)?;
|
382
|
+
class.define_method("sort", method!(RbLazyFrame::sort, 3))?;
|
383
|
+
class.define_method("sort_by_exprs", method!(RbLazyFrame::sort_by_exprs, 3))?;
|
384
|
+
class.define_method("cache", method!(RbLazyFrame::cache, 0))?;
|
129
385
|
class.define_method("collect", method!(RbLazyFrame::collect, 0))?;
|
386
|
+
class.define_method("fetch", method!(RbLazyFrame::fetch, 1))?;
|
130
387
|
class.define_method("filter", method!(RbLazyFrame::filter, 1))?;
|
131
388
|
class.define_method("select", method!(RbLazyFrame::select, 1))?;
|
132
389
|
class.define_method("groupby", method!(RbLazyFrame::groupby, 2))?;
|
390
|
+
class.define_method("groupby_rolling", method!(RbLazyFrame::groupby_rolling, 5))?;
|
391
|
+
class.define_method("groupby_dynamic", method!(RbLazyFrame::groupby_dynamic, 8))?;
|
133
392
|
class.define_method("join", method!(RbLazyFrame::join, 7))?;
|
134
393
|
class.define_method("with_columns", method!(RbLazyFrame::with_columns, 1))?;
|
394
|
+
class.define_method("rename", method!(RbLazyFrame::rename, 2))?;
|
395
|
+
class.define_method("reverse", method!(RbLazyFrame::reverse, 0))?;
|
396
|
+
class.define_method("shift", method!(RbLazyFrame::shift, 1))?;
|
397
|
+
class.define_method("shift_and_fill", method!(RbLazyFrame::shift_and_fill, 2))?;
|
398
|
+
class.define_method("fill_nan", method!(RbLazyFrame::fill_nan, 1))?;
|
399
|
+
class.define_method("min", method!(RbLazyFrame::min, 0))?;
|
400
|
+
class.define_method("max", method!(RbLazyFrame::max, 0))?;
|
401
|
+
class.define_method("sum", method!(RbLazyFrame::sum, 0))?;
|
402
|
+
class.define_method("mean", method!(RbLazyFrame::mean, 0))?;
|
403
|
+
class.define_method("std", method!(RbLazyFrame::std, 1))?;
|
404
|
+
class.define_method("var", method!(RbLazyFrame::var, 1))?;
|
405
|
+
class.define_method("median", method!(RbLazyFrame::median, 0))?;
|
406
|
+
class.define_method("quantile", method!(RbLazyFrame::quantile, 2))?;
|
407
|
+
class.define_method("explode", method!(RbLazyFrame::explode, 1))?;
|
408
|
+
class.define_method("unique", method!(RbLazyFrame::unique, 3))?;
|
409
|
+
class.define_method("drop_nulls", method!(RbLazyFrame::drop_nulls, 1))?;
|
410
|
+
class.define_method("slice", method!(RbLazyFrame::slice, 2))?;
|
411
|
+
class.define_method("tail", method!(RbLazyFrame::tail, 1))?;
|
412
|
+
class.define_method("melt", method!(RbLazyFrame::melt, 4))?;
|
413
|
+
class.define_method("with_row_count", method!(RbLazyFrame::with_row_count, 2))?;
|
414
|
+
class.define_method("drop_columns", method!(RbLazyFrame::drop_columns, 1))?;
|
415
|
+
class.define_method("_clone", method!(RbLazyFrame::clone, 0))?;
|
416
|
+
class.define_method("columns", method!(RbLazyFrame::columns, 0))?;
|
417
|
+
class.define_method("dtypes", method!(RbLazyFrame::dtypes, 0))?;
|
418
|
+
class.define_method("schema", method!(RbLazyFrame::schema, 0))?;
|
419
|
+
class.define_method("unnest", method!(RbLazyFrame::unnest, 1))?;
|
420
|
+
class.define_method("width", method!(RbLazyFrame::width, 0))?;
|
135
421
|
|
136
422
|
let class = module.define_class("RbLazyGroupBy", Default::default())?;
|
137
423
|
class.define_method("agg", method!(RbLazyGroupBy::agg, 1))?;
|
424
|
+
class.define_method("head", method!(RbLazyGroupBy::head, 1))?;
|
425
|
+
class.define_method("tail", method!(RbLazyGroupBy::tail, 1))?;
|
138
426
|
|
139
427
|
let class = module.define_class("RbSeries", Default::default())?;
|
140
428
|
class.define_singleton_method("new_opt_bool", function!(RbSeries::new_opt_bool, 3))?;
|
@@ -149,7 +437,15 @@ fn init() -> RbResult<()> {
|
|
149
437
|
class.define_singleton_method("new_opt_f32", function!(RbSeries::new_opt_f32, 3))?;
|
150
438
|
class.define_singleton_method("new_opt_f64", function!(RbSeries::new_opt_f64, 3))?;
|
151
439
|
class.define_singleton_method("new_str", function!(RbSeries::new_str, 3))?;
|
440
|
+
class.define_method("is_sorted_flag", method!(RbSeries::is_sorted_flag, 0))?;
|
441
|
+
class.define_method(
|
442
|
+
"is_sorted_reverse_flag",
|
443
|
+
method!(RbSeries::is_sorted_reverse_flag, 0),
|
444
|
+
)?;
|
445
|
+
class.define_method("estimated_size", method!(RbSeries::estimated_size, 0))?;
|
446
|
+
class.define_method("get_fmt", method!(RbSeries::get_fmt, 2))?;
|
152
447
|
class.define_method("rechunk", method!(RbSeries::rechunk, 1))?;
|
448
|
+
class.define_method("get_idx", method!(RbSeries::get_idx, 1))?;
|
153
449
|
class.define_method("bitand", method!(RbSeries::bitand, 1))?;
|
154
450
|
class.define_method("bitor", method!(RbSeries::bitor, 1))?;
|
155
451
|
class.define_method("bitxor", method!(RbSeries::bitxor, 1))?;
|
@@ -194,11 +490,28 @@ fn init() -> RbResult<()> {
|
|
194
490
|
class.define_method("len", method!(RbSeries::len, 0))?;
|
195
491
|
class.define_method("to_a", method!(RbSeries::to_a, 0))?;
|
196
492
|
class.define_method("median", method!(RbSeries::median, 0))?;
|
493
|
+
class.define_method("quantile", method!(RbSeries::quantile, 2))?;
|
494
|
+
class.define_method("_clone", method!(RbSeries::clone, 0))?;
|
495
|
+
class.define_method("zip_with", method!(RbSeries::zip_with, 2))?;
|
496
|
+
class.define_method("to_dummies", method!(RbSeries::to_dummies, 0))?;
|
497
|
+
class.define_method("peak_max", method!(RbSeries::peak_max, 0))?;
|
498
|
+
class.define_method("peak_min", method!(RbSeries::peak_min, 0))?;
|
499
|
+
class.define_method("n_unique", method!(RbSeries::n_unique, 0))?;
|
500
|
+
class.define_method("floor", method!(RbSeries::floor, 0))?;
|
501
|
+
class.define_method("shrink_to_fit", method!(RbSeries::shrink_to_fit, 0))?;
|
502
|
+
class.define_method("dot", method!(RbSeries::dot, 1))?;
|
503
|
+
class.define_method("skew", method!(RbSeries::skew, 1))?;
|
504
|
+
class.define_method("kurtosis", method!(RbSeries::kurtosis, 2))?;
|
505
|
+
class.define_method("cast", method!(RbSeries::cast, 2))?;
|
506
|
+
class.define_method("time_unit", method!(RbSeries::time_unit, 0))?;
|
197
507
|
// rest
|
198
508
|
class.define_method("cumsum", method!(RbSeries::cumsum, 1))?;
|
199
509
|
class.define_method("cummax", method!(RbSeries::cummax, 1))?;
|
200
510
|
class.define_method("cummin", method!(RbSeries::cummin, 1))?;
|
511
|
+
class.define_method("cumprod", method!(RbSeries::cumprod, 1))?;
|
201
512
|
class.define_method("slice", method!(RbSeries::slice, 2))?;
|
513
|
+
class.define_method("ceil", method!(RbSeries::ceil, 0))?;
|
514
|
+
class.define_method("round", method!(RbSeries::round, 1))?;
|
202
515
|
|
203
516
|
let class = module.define_class("RbWhen", Default::default())?;
|
204
517
|
class.define_method("_then", method!(RbWhen::then, 1))?;
|