@ohos-ports/nodejs-polars 0.22.2-beta.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.
Files changed (71) hide show
  1. package/LICENSE +19 -0
  2. package/README.md +217 -0
  3. package/bin/cfg.d.ts +156 -0
  4. package/bin/cfg.js +52 -0
  5. package/bin/dataframe.d.ts +2008 -0
  6. package/bin/dataframe.js +771 -0
  7. package/bin/datatypes/conversion.d.ts +2 -0
  8. package/bin/datatypes/conversion.js +2 -0
  9. package/bin/datatypes/datatype.d.ts +252 -0
  10. package/bin/datatypes/datatype.js +386 -0
  11. package/bin/datatypes/field.d.ts +26 -0
  12. package/bin/datatypes/field.js +36 -0
  13. package/bin/datatypes/index.d.ts +42 -0
  14. package/bin/datatypes/index.js +119 -0
  15. package/bin/error.d.ts +7 -0
  16. package/bin/error.js +17 -0
  17. package/bin/functions.d.ts +26 -0
  18. package/bin/functions.js +208 -0
  19. package/bin/groupby.d.ts +173 -0
  20. package/bin/groupby.js +156 -0
  21. package/bin/html.d.ts +4 -0
  22. package/bin/html.js +18 -0
  23. package/bin/index.d.ts +252 -0
  24. package/bin/index.js +265 -0
  25. package/bin/internals/construction.d.ts +7 -0
  26. package/bin/internals/construction.js +237 -0
  27. package/bin/internals/polars_internal.d.ts +2 -0
  28. package/bin/internals/polars_internal.js +7 -0
  29. package/bin/io.d.ts +421 -0
  30. package/bin/io.js +332 -0
  31. package/bin/lazy/dataframe.d.ts +693 -0
  32. package/bin/lazy/dataframe.js +421 -0
  33. package/bin/lazy/expr/datetime.d.ts +8 -0
  34. package/bin/lazy/expr/datetime.js +25 -0
  35. package/bin/lazy/expr/index.d.ts +1155 -0
  36. package/bin/lazy/expr/index.js +629 -0
  37. package/bin/lazy/expr/list.d.ts +8 -0
  38. package/bin/lazy/expr/list.js +115 -0
  39. package/bin/lazy/expr/string.d.ts +534 -0
  40. package/bin/lazy/expr/string.js +131 -0
  41. package/bin/lazy/expr/struct.d.ts +126 -0
  42. package/bin/lazy/expr/struct.js +26 -0
  43. package/bin/lazy/functions.d.ts +620 -0
  44. package/bin/lazy/functions.js +691 -0
  45. package/bin/lazy/groupby.d.ts +24 -0
  46. package/bin/lazy/groupby.js +22 -0
  47. package/bin/lazy/index.d.ts +4 -0
  48. package/bin/lazy/index.js +20 -0
  49. package/bin/lazy/whenthen.d.ts +67 -0
  50. package/bin/lazy/whenthen.js +81 -0
  51. package/bin/native-polars.d.ts +2 -0
  52. package/bin/native-polars.js +267 -0
  53. package/bin/series/datetime.d.ts +8 -0
  54. package/bin/series/datetime.js +25 -0
  55. package/bin/series/index.d.ts +1116 -0
  56. package/bin/series/index.js +689 -0
  57. package/bin/series/list.d.ts +8 -0
  58. package/bin/series/list.js +87 -0
  59. package/bin/series/string.d.ts +300 -0
  60. package/bin/series/string.js +125 -0
  61. package/bin/series/struct.d.ts +36 -0
  62. package/bin/series/struct.js +35 -0
  63. package/bin/shared_traits.d.ts +1325 -0
  64. package/bin/shared_traits.js +2 -0
  65. package/bin/sql.d.ts +244 -0
  66. package/bin/sql.js +63 -0
  67. package/bin/types.d.ts +284 -0
  68. package/bin/types.js +2 -0
  69. package/bin/utils.d.ts +38 -0
  70. package/bin/utils.js +69 -0
  71. package/package.json +51 -0
@@ -0,0 +1,629 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
15
+ }) : function(o, v) {
16
+ o["default"] = v;
17
+ });
18
+ var __importStar = (this && this.__importStar) || (function () {
19
+ var ownKeys = function(o) {
20
+ ownKeys = Object.getOwnPropertyNames || function (o) {
21
+ var ar = [];
22
+ for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
23
+ return ar;
24
+ };
25
+ return ownKeys(o);
26
+ };
27
+ return function (mod) {
28
+ if (mod && mod.__esModule) return mod;
29
+ var result = {};
30
+ if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
31
+ __setModuleDefault(result, mod);
32
+ return result;
33
+ };
34
+ })();
35
+ var __importDefault = (this && this.__importDefault) || function (mod) {
36
+ return (mod && mod.__esModule) ? mod : { "default": mod };
37
+ };
38
+ Object.defineProperty(exports, "__esModule", { value: true });
39
+ exports.exprToLitOrExpr = exports.Expr = exports._Expr = void 0;
40
+ const dt = __importStar(require("./datetime"));
41
+ const lst = __importStar(require("./list"));
42
+ const str = __importStar(require("./string"));
43
+ const struct = __importStar(require("./struct"));
44
+ const types_1 = require("node:util/types");
45
+ const polars_internal_1 = __importDefault(require("../../internals/polars_internal"));
46
+ const series_1 = require("../../series");
47
+ const utils_1 = require("../../utils");
48
+ /** @ignore */
49
+ const _Expr = (_expr) => {
50
+ const unwrap = (method, ...args) => {
51
+ return _expr[method](...args);
52
+ };
53
+ const wrap = (method, ...args) => {
54
+ return (0, exports._Expr)(unwrap(method, ...args));
55
+ };
56
+ const wrapExprArg = (method, lit = false) => (other) => {
57
+ const expr = (0, exports.exprToLitOrExpr)(other, lit).inner();
58
+ return wrap(method, expr);
59
+ };
60
+ const rolling = (method) => (opts, weights, minPeriods, center) => {
61
+ const windowSize = opts?.["windowSize"] ?? (typeof opts === "number" ? opts : null);
62
+ if (windowSize === null) {
63
+ throw new Error("window size is required");
64
+ }
65
+ const callOpts = {
66
+ windowSize: windowSize,
67
+ weights: opts?.["weights"] ?? weights,
68
+ minPeriods: opts?.["minPeriods"] ?? minPeriods ?? windowSize,
69
+ center: opts?.["center"] ?? center ?? false,
70
+ };
71
+ return wrap(method, callOpts);
72
+ };
73
+ return {
74
+ _expr,
75
+ [Symbol.toStringTag]() {
76
+ return "Expr";
77
+ },
78
+ [utils_1.INSPECT_SYMBOL]() {
79
+ return _expr.toString();
80
+ },
81
+ serialize(format) {
82
+ return _expr.serialize(format);
83
+ },
84
+ toString() {
85
+ return _expr.toString();
86
+ },
87
+ toJSON(...args) {
88
+ // this is passed by `JSON.stringify` when calling `toJSON()`
89
+ if (args[0] === "") {
90
+ return _expr.toJs();
91
+ }
92
+ return _expr.serialize("json").toString();
93
+ },
94
+ get str() {
95
+ return str.ExprStringFunctions(_expr);
96
+ },
97
+ get lst() {
98
+ return lst.ExprListFunctions(_expr);
99
+ },
100
+ get date() {
101
+ return dt.ExprDateTimeFunctions(_expr);
102
+ },
103
+ get struct() {
104
+ return struct.ExprStructFunctions(_expr);
105
+ },
106
+ abs() {
107
+ return (0, exports._Expr)(_expr.abs());
108
+ },
109
+ aggGroups() {
110
+ return (0, exports._Expr)(_expr.aggGroups());
111
+ },
112
+ alias(name) {
113
+ return (0, exports._Expr)(_expr.alias(name));
114
+ },
115
+ inner() {
116
+ return _expr;
117
+ },
118
+ and(other) {
119
+ const expr = (0, exports.exprToLitOrExpr)(other, false).inner();
120
+ return (0, exports._Expr)(_expr.and(expr));
121
+ },
122
+ arccos() {
123
+ return (0, exports._Expr)(_expr.arccos());
124
+ },
125
+ arccosh() {
126
+ return (0, exports._Expr)(_expr.arccosh());
127
+ },
128
+ arcsin() {
129
+ return (0, exports._Expr)(_expr.arcsin());
130
+ },
131
+ arcsinh() {
132
+ return (0, exports._Expr)(_expr.arcsinh());
133
+ },
134
+ arctan() {
135
+ return (0, exports._Expr)(_expr.arctan());
136
+ },
137
+ arctanh() {
138
+ return (0, exports._Expr)(_expr.arctanh());
139
+ },
140
+ argMax() {
141
+ return (0, exports._Expr)(_expr.argMax());
142
+ },
143
+ argMin() {
144
+ return (0, exports._Expr)(_expr.argMin());
145
+ },
146
+ argSort(descending = false, nullsLast = false) {
147
+ descending = descending?.descending ?? descending?.reverse ?? descending;
148
+ nullsLast = descending?.nullsLast ?? nullsLast;
149
+ return (0, exports._Expr)(_expr.argSort(descending, nullsLast));
150
+ },
151
+ argUnique() {
152
+ return (0, exports._Expr)(_expr.argUnique());
153
+ },
154
+ as(name) {
155
+ return (0, exports._Expr)(_expr.alias(name));
156
+ },
157
+ backwardFill() {
158
+ return (0, exports._Expr)(_expr.backwardFill());
159
+ },
160
+ cast(dtype, strict = false) {
161
+ return (0, exports._Expr)(_expr.cast(dtype, strict));
162
+ },
163
+ ceil() {
164
+ return (0, exports._Expr)(_expr.ceil());
165
+ },
166
+ clip(arg, max) {
167
+ if (typeof arg === "number") {
168
+ return (0, exports._Expr)(_expr.clip((0, exports.exprToLitOrExpr)(arg)._expr, (0, exports.exprToLitOrExpr)(max)._expr));
169
+ }
170
+ return (0, exports._Expr)(_expr.clip((0, exports.exprToLitOrExpr)(arg.min)._expr, (0, exports.exprToLitOrExpr)(arg.max)._expr));
171
+ },
172
+ cos() {
173
+ return (0, exports._Expr)(_expr.cos());
174
+ },
175
+ cosh() {
176
+ return (0, exports._Expr)(_expr.cosh());
177
+ },
178
+ cot() {
179
+ return (0, exports._Expr)(_expr.cot());
180
+ },
181
+ count() {
182
+ return (0, exports._Expr)(_expr.count());
183
+ },
184
+ cumCount(reverse = false) {
185
+ reverse = reverse?.reverse ?? reverse;
186
+ return (0, exports._Expr)(_expr.cumCount(reverse?.reverse ?? reverse));
187
+ },
188
+ cumMax(reverse = false) {
189
+ reverse = reverse?.reverse ?? reverse;
190
+ return (0, exports._Expr)(_expr.cumMax(reverse));
191
+ },
192
+ cumMin(reverse = false) {
193
+ reverse = reverse?.reverse ?? reverse;
194
+ return (0, exports._Expr)(_expr.cumMin(reverse));
195
+ },
196
+ cumProd(reverse = false) {
197
+ reverse = reverse?.reverse ?? reverse;
198
+ return (0, exports._Expr)(_expr.cumProd(reverse));
199
+ },
200
+ cumSum(reverse = false) {
201
+ reverse = reverse?.reverse ?? reverse;
202
+ return (0, exports._Expr)(_expr.cumSum(reverse));
203
+ },
204
+ diff(n, nullBehavior = "ignore") {
205
+ if (typeof n === "number") {
206
+ return (0, exports._Expr)(_expr.diff((0, exports.exprToLitOrExpr)(n, false), nullBehavior));
207
+ }
208
+ return (0, exports._Expr)(_expr.diff((0, exports.exprToLitOrExpr)(n.n, false), n.nullBehavior));
209
+ },
210
+ dot(other) {
211
+ const expr = (0, exports.exprToLitOrExpr)(other, false).inner();
212
+ return (0, exports._Expr)(_expr.dot(expr));
213
+ },
214
+ ewmMean(opts, adjust, minPeriods, bias, ignoreNulls) {
215
+ if (opts) {
216
+ if (typeof opts === "number") {
217
+ return wrap("ewmMean", opts, adjust ?? true, minPeriods ?? 1, bias ?? false, ignoreNulls ?? true);
218
+ }
219
+ return wrap("ewmMean", opts.alpha ?? 0.5, opts.adjust ?? true, opts.minPeriods ?? 1, opts.bias ?? false, opts.ignoreNulls ?? true);
220
+ }
221
+ return wrap("ewmMean", 0.5, true, 1, false, true);
222
+ },
223
+ ewmStd(opts, adjust, minPeriods, bias, ignoreNulls) {
224
+ if (opts) {
225
+ if (typeof opts === "number") {
226
+ return wrap("ewmStd", opts, adjust ?? true, minPeriods ?? 1, bias ?? false, ignoreNulls ?? true);
227
+ }
228
+ return wrap("ewmStd", opts.alpha ?? 0.5, opts.adjust ?? true, opts.minPeriods ?? 1, opts.bias ?? false, opts.ignoreNulls ?? true);
229
+ }
230
+ return wrap("ewmStd", 0.5, true, 1, false, true);
231
+ },
232
+ ewmVar(opts, adjust, minPeriods, bias, ignoreNulls) {
233
+ if (opts) {
234
+ if (typeof opts === "number") {
235
+ return wrap("ewmVar", opts, adjust ?? true, minPeriods ?? 1, bias ?? false, ignoreNulls ?? true);
236
+ }
237
+ return wrap("ewmVar", opts.alpha ?? 0.5, opts.adjust ?? true, opts.minPeriods ?? 1, opts.bias ?? false, opts.ignoreNulls ?? true);
238
+ }
239
+ return wrap("ewmVar", 0.5, true, 1, false, true);
240
+ },
241
+ exclude(...columns) {
242
+ return (0, exports._Expr)(_expr.exclude(columns.flat(2)));
243
+ },
244
+ explode() {
245
+ return (0, exports._Expr)(_expr.explode());
246
+ },
247
+ exp() {
248
+ return (0, exports._Expr)(_expr.exp());
249
+ },
250
+ extendConstant(o, n) {
251
+ if (n !== null && typeof n === "number") {
252
+ return (0, exports._Expr)(_expr.extendConstant(o, n));
253
+ }
254
+ return (0, exports._Expr)(_expr.extendConstant(o.value, o.n));
255
+ },
256
+ fillNan(other) {
257
+ const expr = (0, exports.exprToLitOrExpr)(other, true).inner();
258
+ return (0, exports._Expr)(_expr.fillNan(expr));
259
+ },
260
+ fillNull(fillValue) {
261
+ if (["backward", "forward", "mean", "min", "max", "zero", "one"].includes(fillValue)) {
262
+ return (0, exports._Expr)(_expr.fillNullWithStrategy(fillValue));
263
+ }
264
+ const expr = (0, exports.exprToLitOrExpr)(fillValue).inner();
265
+ return (0, exports._Expr)(_expr.fillNull(expr));
266
+ },
267
+ filter(predicate) {
268
+ const expr = (0, exports.exprToLitOrExpr)(predicate).inner();
269
+ return (0, exports._Expr)(_expr.filter(expr));
270
+ },
271
+ first() {
272
+ return (0, exports._Expr)(_expr.first());
273
+ },
274
+ flatten() {
275
+ return (0, exports._Expr)(_expr.explode());
276
+ },
277
+ floor() {
278
+ return (0, exports._Expr)(_expr.floor());
279
+ },
280
+ forwardFill() {
281
+ return (0, exports._Expr)(_expr.forwardFill());
282
+ },
283
+ gather(indices) {
284
+ if (Array.isArray(indices)) {
285
+ indices = polars_internal_1.default.litSeries((0, series_1.Series)("", indices, polars_internal_1.default.Int64).inner());
286
+ }
287
+ else {
288
+ indices = indices.inner();
289
+ }
290
+ return wrap("gather", indices);
291
+ },
292
+ gatherEvery(n, offset = 0) {
293
+ return (0, exports._Expr)(_expr.gatherEvery(n, offset));
294
+ },
295
+ hash(obj = 0, k1 = 1, k2 = 2, k3 = 3) {
296
+ if (typeof obj === "number" || typeof obj === "bigint") {
297
+ return wrap("hash", BigInt(obj), BigInt(k1), BigInt(k2), BigInt(k3));
298
+ }
299
+ const o = { k0: obj, k1: k1, k2: k2, k3: k3, ...obj };
300
+ return wrap("hash", BigInt(o.k0), BigInt(o.k1), BigInt(o.k2), BigInt(o.k3));
301
+ },
302
+ head(length) {
303
+ if (typeof length === "number") {
304
+ return wrap("head", length);
305
+ }
306
+ return wrap("head", length.length);
307
+ },
308
+ implode() {
309
+ return (0, exports._Expr)(_expr.implode());
310
+ },
311
+ interpolate(method = "linear") {
312
+ return (0, exports._Expr)(_expr.interpolate(method));
313
+ },
314
+ isDuplicated() {
315
+ return (0, exports._Expr)(_expr.isDuplicated());
316
+ },
317
+ isFinite() {
318
+ return (0, exports._Expr)(_expr.isFinite());
319
+ },
320
+ isInfinite() {
321
+ return (0, exports._Expr)(_expr.isInfinite());
322
+ },
323
+ isFirstDistinct() {
324
+ return (0, exports._Expr)(_expr.isFirstDistinct());
325
+ },
326
+ isNan() {
327
+ return (0, exports._Expr)(_expr.isNan());
328
+ },
329
+ isNotNan() {
330
+ return (0, exports._Expr)(_expr.isNotNan());
331
+ },
332
+ isNotNull() {
333
+ return (0, exports._Expr)(_expr.isNotNull());
334
+ },
335
+ isNull() {
336
+ return (0, exports._Expr)(_expr.isNull());
337
+ },
338
+ isUnique() {
339
+ return (0, exports._Expr)(_expr.isUnique());
340
+ },
341
+ isIn(other, nullsEquals = false) {
342
+ if (Array.isArray(other)) {
343
+ other = polars_internal_1.default.lit((0, series_1.Series)(other).inner());
344
+ }
345
+ else {
346
+ other = (0, exports.exprToLitOrExpr)(other, false).inner();
347
+ }
348
+ return wrap("isIn", other, nullsEquals);
349
+ },
350
+ keepName() {
351
+ return (0, exports._Expr)(_expr.keepName());
352
+ },
353
+ kurtosis(obj, bias = true) {
354
+ const fisher = obj?.["fisher"] ?? (typeof obj === "boolean" ? obj : true);
355
+ bias = obj?.["bias"] ?? bias;
356
+ return (0, exports._Expr)(_expr.kurtosis(fisher, bias));
357
+ },
358
+ last() {
359
+ return (0, exports._Expr)(_expr.last());
360
+ },
361
+ list() {
362
+ return (0, exports._Expr)(_expr.list());
363
+ },
364
+ log1p() {
365
+ return (0, exports._Expr)(_expr.log1p());
366
+ },
367
+ log(base) {
368
+ return (0, exports._Expr)(_expr.log(base ?? Math.E));
369
+ },
370
+ lowerBound() {
371
+ return (0, exports._Expr)(_expr.lowerBound());
372
+ },
373
+ peakMax() {
374
+ return (0, exports._Expr)(_expr.peakMax());
375
+ },
376
+ peakMin() {
377
+ return (0, exports._Expr)(_expr.peakMin());
378
+ },
379
+ max() {
380
+ return (0, exports._Expr)(_expr.max());
381
+ },
382
+ mean() {
383
+ return (0, exports._Expr)(_expr.mean());
384
+ },
385
+ median() {
386
+ return (0, exports._Expr)(_expr.median());
387
+ },
388
+ min() {
389
+ return (0, exports._Expr)(_expr.min());
390
+ },
391
+ mode() {
392
+ return (0, exports._Expr)(_expr.mode());
393
+ },
394
+ not() {
395
+ return (0, exports._Expr)(_expr.not());
396
+ },
397
+ nUnique() {
398
+ return (0, exports._Expr)(_expr.nUnique());
399
+ },
400
+ or(other) {
401
+ const expr = (0, exports.exprToLitOrExpr)(other).inner();
402
+ return (0, exports._Expr)(_expr.or(expr));
403
+ },
404
+ over(...exprs) {
405
+ const partitionBy = (0, utils_1.selectionToExprList)(exprs, false);
406
+ return wrap("over", partitionBy);
407
+ },
408
+ pow(exponent) {
409
+ return (0, exports._Expr)(_expr.pow(exponent?.exponent ?? exponent));
410
+ },
411
+ prefix(prefix) {
412
+ return (0, exports._Expr)(_expr.prefix(prefix));
413
+ },
414
+ quantile(quantile, interpolation = "nearest") {
415
+ if (exports.Expr.isExpr(quantile)) {
416
+ quantile = quantile._expr;
417
+ }
418
+ else {
419
+ quantile = polars_internal_1.default.lit(quantile);
420
+ }
421
+ return (0, exports._Expr)(_expr.quantile(quantile, interpolation));
422
+ },
423
+ rank(method = "average", descending = false) {
424
+ return (0, exports._Expr)(_expr.rank(method?.method ?? method, method?.descending ?? descending));
425
+ },
426
+ reinterpret(signed = true) {
427
+ signed = signed?.signed ?? signed;
428
+ return (0, exports._Expr)(_expr.reinterpret(signed));
429
+ },
430
+ repeatBy(expr) {
431
+ const e = (0, exports.exprToLitOrExpr)(expr, false)._expr;
432
+ return (0, exports._Expr)(_expr.repeatBy(e));
433
+ },
434
+ replace(old, newValue) {
435
+ let oldIn = old;
436
+ let newIn = newValue;
437
+ if (old && typeof old === "object" && !Array.isArray(old)) {
438
+ oldIn = Object.keys(old["old"]);
439
+ newIn = Object.values(old["old"]);
440
+ }
441
+ return (0, exports._Expr)(_expr.replace((0, exports.exprToLitOrExpr)(oldIn)._expr, (0, exports.exprToLitOrExpr)(newIn)._expr));
442
+ },
443
+ replaceStrict(old, newValue, defaultValue, returnDtype) {
444
+ let oldIn = old;
445
+ let newIn = newValue;
446
+ let defIn = defaultValue;
447
+ if (old && typeof old === "object" && !Array.isArray(old)) {
448
+ oldIn = Object.keys(old["old"]);
449
+ newIn = Object.values(old["old"]);
450
+ defIn = old["default_"];
451
+ }
452
+ return (0, exports._Expr)(_expr.replaceStrict((0, exports.exprToLitOrExpr)(oldIn)._expr, (0, exports.exprToLitOrExpr)(newIn)._expr, defIn ? (0, exports.exprToLitOrExpr)(defIn)._expr : undefined, returnDtype));
453
+ },
454
+ reverse() {
455
+ return (0, exports._Expr)(_expr.reverse());
456
+ },
457
+ rollingMax: rolling("rollingMax"),
458
+ rollingMean: rolling("rollingMean"),
459
+ rollingMin: rolling("rollingMin"),
460
+ rollingSum: rolling("rollingSum"),
461
+ rollingStd: rolling("rollingStd"),
462
+ rollingVar: rolling("rollingVar"),
463
+ rollingMedian: rolling("rollingMedian"),
464
+ rollingQuantile(val, _interpolation, windowSize, weights, minPeriods, center, by, closedWindow, warnIfUnsorted) {
465
+ if (typeof val === "number") {
466
+ return wrap("rollingQuantile", {
467
+ windowSize: `${windowSize}i`,
468
+ weights,
469
+ minPeriods,
470
+ center,
471
+ });
472
+ }
473
+ windowSize =
474
+ val?.["windowSize"] ?? (typeof val === "number" ? val : null);
475
+ if (windowSize === null) {
476
+ throw new Error("window size is required");
477
+ }
478
+ return wrap("rollingQuantile", val.quantile, val.interpolation ?? "nearest", windowSize, val?.["weights"] ?? weights ?? null, val?.["minPeriods"] ?? minPeriods ?? windowSize, val?.["center"] ?? center ?? false, val?.["by"] ?? by, closedWindow, val?.["warnIfUnsorted"] ?? warnIfUnsorted ?? true);
479
+ },
480
+ rollingSkew(val, bias = true) {
481
+ if (typeof val === "number") {
482
+ return wrap("rollingSkew", val, bias);
483
+ }
484
+ return wrap("rollingSkew", val.windowSize, val.bias ?? bias);
485
+ },
486
+ round(decimals, mode) {
487
+ return (0, exports._Expr)(_expr.round(decimals?.decimals ?? decimals, decimals?.mode ?? mode ?? "halftoeven"));
488
+ },
489
+ sample(opts, frac, withReplacement = false, seed) {
490
+ if (opts?.n !== undefined || opts?.frac !== undefined) {
491
+ return this.sample(opts.n, opts.frac, opts.withReplacement, opts.seed);
492
+ }
493
+ if (typeof opts === "number") {
494
+ return wrap("sampleN", (0, exports.exprToLitOrExpr)(opts), withReplacement, false, seed);
495
+ }
496
+ if (typeof frac === "number") {
497
+ return wrap("sampleFrac", (0, exports.exprToLitOrExpr)(frac), withReplacement, false, seed);
498
+ }
499
+ throw new TypeError("must specify either 'frac' or 'n'");
500
+ },
501
+ shift(periods) {
502
+ return (0, exports._Expr)(_expr.shift((0, exports.exprToLitOrExpr)(periods)._expr));
503
+ },
504
+ shiftAndFill(optOrPeriods, fillValue) {
505
+ if (typeof optOrPeriods === "number") {
506
+ return wrap("shiftAndFill", optOrPeriods, fillValue);
507
+ }
508
+ return wrap("shiftAndFill", optOrPeriods.periods, optOrPeriods.fillValue);
509
+ },
510
+ skew(bias) {
511
+ return wrap("skew", bias?.bias ?? bias ?? true);
512
+ },
513
+ sin() {
514
+ return (0, exports._Expr)(_expr.sin());
515
+ },
516
+ sinh() {
517
+ return (0, exports._Expr)(_expr.sinh());
518
+ },
519
+ slice(arg, len) {
520
+ if (typeof arg === "number") {
521
+ return wrap("slice", polars_internal_1.default.lit(arg), polars_internal_1.default.lit(len));
522
+ }
523
+ return wrap("slice", polars_internal_1.default.lit(arg.offset), polars_internal_1.default.lit(arg.length));
524
+ },
525
+ sort(descending = false, nullsLast = false, maintainOrder = false) {
526
+ if (typeof descending === "boolean") {
527
+ return wrap("sortWith", descending, nullsLast, false, maintainOrder);
528
+ }
529
+ return wrap("sortWith", descending?.descending ?? descending?.reverse ?? false, descending?.nullsLast ?? nullsLast, false, descending?.maintainOrder ?? maintainOrder);
530
+ },
531
+ sortBy(arg, descending = false) {
532
+ if (arg?.by !== undefined) {
533
+ return this.sortBy(arg.by, arg.descending ?? arg.reverse ?? false);
534
+ }
535
+ descending = Array.isArray(descending)
536
+ ? descending.flat()
537
+ : [descending];
538
+ const by = (0, utils_1.selectionToExprList)(arg, false);
539
+ return wrap("sortBy", by, descending);
540
+ },
541
+ std() {
542
+ return (0, exports._Expr)(_expr.std());
543
+ },
544
+ suffix(suffix) {
545
+ return (0, exports._Expr)(_expr.suffix(suffix));
546
+ },
547
+ sum() {
548
+ return (0, exports._Expr)(_expr.sum());
549
+ },
550
+ tail(length) {
551
+ return (0, exports._Expr)(_expr.tail(length));
552
+ },
553
+ tan() {
554
+ return (0, exports._Expr)(_expr.tan());
555
+ },
556
+ tanh() {
557
+ return (0, exports._Expr)(_expr.tanh());
558
+ },
559
+ unique(opt) {
560
+ if (opt || opt?.maintainOrder) {
561
+ return wrap("uniqueStable");
562
+ }
563
+ return wrap("unique");
564
+ },
565
+ upperBound() {
566
+ return (0, exports._Expr)(_expr.upperBound());
567
+ },
568
+ where(expr) {
569
+ return this.filter(expr);
570
+ },
571
+ var() {
572
+ return (0, exports._Expr)(_expr.var());
573
+ },
574
+ add: wrapExprArg("add"),
575
+ sub: wrapExprArg("sub"),
576
+ div: wrapExprArg("div"),
577
+ mul: wrapExprArg("mul"),
578
+ rem: wrapExprArg("rem"),
579
+ plus: wrapExprArg("add"),
580
+ minus: wrapExprArg("sub"),
581
+ divideBy: wrapExprArg("div"),
582
+ multiplyBy: wrapExprArg("mul"),
583
+ modulo: wrapExprArg("rem"),
584
+ eq: wrapExprArg("eq"),
585
+ equals: wrapExprArg("eq"),
586
+ gtEq: wrapExprArg("gtEq"),
587
+ greaterThanEquals: wrapExprArg("gtEq"),
588
+ gt: wrapExprArg("gt"),
589
+ greaterThan: wrapExprArg("gt"),
590
+ ltEq: wrapExprArg("ltEq"),
591
+ lessThanEquals: wrapExprArg("ltEq"),
592
+ lt: wrapExprArg("lt"),
593
+ lessThan: wrapExprArg("lt"),
594
+ neq: wrapExprArg("neq"),
595
+ notEquals: wrapExprArg("neq"),
596
+ };
597
+ };
598
+ exports._Expr = _Expr;
599
+ const isExpr = (anyVal) => {
600
+ try {
601
+ return anyVal?.[Symbol.toStringTag]?.() === "Expr";
602
+ }
603
+ catch (_err) {
604
+ return false;
605
+ }
606
+ };
607
+ const deserialize = (buf, format) => {
608
+ return (0, exports._Expr)(polars_internal_1.default.JsExpr.deserialize(buf, format));
609
+ };
610
+ exports.Expr = Object.assign(exports._Expr, {
611
+ isExpr,
612
+ deserialize,
613
+ });
614
+ const exprToLitOrExpr = (expr, stringToLit = true) => {
615
+ if ((0, types_1.isRegExp)(expr)) {
616
+ return (0, exports._Expr)(polars_internal_1.default.lit((0, utils_1.regexToString)(expr)));
617
+ }
618
+ if (typeof expr === "string" && !stringToLit) {
619
+ return (0, exports._Expr)(polars_internal_1.default.col(expr));
620
+ }
621
+ if (exports.Expr.isExpr(expr)) {
622
+ return expr;
623
+ }
624
+ if (series_1.Series.isSeries(expr)) {
625
+ return (0, exports._Expr)(polars_internal_1.default.litSeries(expr._s));
626
+ }
627
+ return (0, exports._Expr)(polars_internal_1.default.lit(expr));
628
+ };
629
+ exports.exprToLitOrExpr = exprToLitOrExpr;
@@ -0,0 +1,8 @@
1
+ import type { ListFunctions } from "../../shared_traits";
2
+ import { Expr } from "../expr";
3
+ /**
4
+ * List functions for Lazy dataframes
5
+ */
6
+ export interface ExprList extends ListFunctions<Expr> {
7
+ }
8
+ export declare const ExprListFunctions: (_expr: any) => ExprList;