df-script 1.8.0 → 2.0.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 (64) hide show
  1. package/README.md +153 -203
  2. package/dist/api.d.ts +41 -36
  3. package/dist/columnExpressions/ColumnExpr.d.ts +5 -8
  4. package/dist/columnExpressions/ExprBase.d.ts +7 -0
  5. package/dist/columnExpressions/constants.d.ts +1 -0
  6. package/dist/columnExpressions/functions/all.d.ts +13 -13
  7. package/dist/columnExpressions/functions/coalesce.d.ts +2 -2
  8. package/dist/columnExpressions/functions/duration.d.ts +16 -21
  9. package/dist/columnExpressions/functions/element.d.ts +10 -10
  10. package/dist/columnExpressions/functions/exclude.d.ts +14 -14
  11. package/dist/columnExpressions/functions/implode.d.ts +7 -7
  12. package/dist/columnExpressions/functions/lit.d.ts +9 -9
  13. package/dist/columnExpressions/functions/seqRange.d.ts +69 -0
  14. package/dist/columnExpressions/functions/struct.d.ts +6 -6
  15. package/dist/columnExpressions/functions/when.d.ts +31 -32
  16. package/dist/columnExpressions/index.d.ts +4 -7
  17. package/dist/columnExpressions/mixins/AggregationExpr.d.ts +672 -141
  18. package/dist/columnExpressions/mixins/ArithmeticExpr.d.ts +701 -327
  19. package/dist/columnExpressions/mixins/ArrayExpr.d.ts +543 -231
  20. package/dist/columnExpressions/mixins/ComparisonExpr.d.ts +398 -201
  21. package/dist/columnExpressions/mixins/LogicalExpr.d.ts +59 -29
  22. package/dist/columnExpressions/mixins/ManipulationExpr.d.ts +23 -9
  23. package/dist/columnExpressions/mixins/StandardExpr.d.ts +3234 -0
  24. package/dist/columnExpressions/mixins/StringExpr.d.ts +1299 -396
  25. package/dist/columnExpressions/mixins/StructExpr.d.ts +72 -30
  26. package/dist/columnExpressions/mixins/TemporalExpr.d.ts +518 -212
  27. package/dist/columnExpressions/mixins/WindowExpr.d.ts +270 -102
  28. package/dist/columnExpressions/typeInference.d.ts +13 -0
  29. package/dist/columnExpressions/types.d.ts +6 -1
  30. package/dist/columnExpressions/utils.d.ts +16 -0
  31. package/dist/constants.d.ts +38 -0
  32. package/dist/dataframe/dataframe.d.ts +755 -608
  33. package/dist/dataframe/grouped/grouped.d.ts +24 -6
  34. package/dist/dataframe/grouped.d.ts +70 -0
  35. package/dist/dataframe/index.d.ts +1 -1
  36. package/dist/dataframe/lazy.d.ts +37 -0
  37. package/dist/dataframe/types.d.ts +46 -22
  38. package/dist/dataframe/utils.d.ts +10 -4
  39. package/dist/datatypes/index.d.ts +11 -4
  40. package/dist/expressions.js +1 -0
  41. package/dist/expressions.mjs +1 -0
  42. package/dist/functions/concat.d.ts +68 -16
  43. package/dist/functions/index.d.ts +2 -2
  44. package/dist/functions/readCsv.d.ts +35 -0
  45. package/dist/functions/readJson.d.ts +33 -0
  46. package/dist/index.js +5 -6
  47. package/dist/index.mjs +5 -6
  48. package/dist/types.d.ts +148 -7
  49. package/dist/utils/array.d.ts +54 -18
  50. package/dist/utils/binary.d.ts +6 -2
  51. package/dist/utils/csv.d.ts +4 -1
  52. package/dist/utils/date.d.ts +3 -19
  53. package/dist/utils/duration.d.ts +7 -5
  54. package/dist/utils/json.d.ts +56 -2
  55. package/dist/utils/number.d.ts +5 -2
  56. package/dist/utils/object.d.ts +7 -12
  57. package/dist/utils/string.d.ts +83 -2
  58. package/dist/utils/table.d.ts +76 -0
  59. package/dist/utils.js +4 -0
  60. package/dist/utils.mjs +4 -0
  61. package/package.json +29 -8
  62. package/dist/assets/index-DBhGK6Tp.css +0 -1
  63. package/dist/assets/index-DEJEV_tU.js +0 -195
  64. package/dist/index.html +0 -17
@@ -0,0 +1,3234 @@
1
+ import type { IExpr, AggFn, SkewOptions, KurtosisOptions, EntropyOptions, FillNullOptions, RollingOptions } from "../../types";
2
+ import type { RandomOptions, NumericArg, IsCloseOptions } from "../types";
3
+ import { ExprBase } from "../ExprBase";
4
+ import { UniqueArrayStatsOptions } from "../../utils";
5
+ /**
6
+ * @namespace $df.col
7
+ * @category ColumnExpression
8
+ * @syntax $df.col(<column_name>).{symbol}(...)
9
+ */
10
+ export declare class StandardExpr extends ExprBase {
11
+ _cum(reverse: boolean, initialVal: any, stepFn: (acc: any, val: any) => any, postFn?: (acc: any, hasValid: boolean) => any): this;
12
+ _deriveAgg(fn: AggFn<any>): this;
13
+ _deriveAggBinary(other: any, fn: AggFn<[any, any]>): this;
14
+ get _isWindow(): boolean;
15
+ _window(evaluateWindow: (this: IExpr, groupPreValues: any[], partitionIndices: number[], currentIndex: number) => any): this;
16
+ /**
17
+ * Computes the absolute value of the column values.
18
+ * @returns ColumnExpression
19
+ * @example
20
+ * >>> const df = $df.data({ a: [1, 2, 3] })
21
+ * >>> df
22
+ * shape: (3, 1)
23
+ * ┌───┐
24
+ * │ a │
25
+ * ├───┤
26
+ * │ 1 │
27
+ * │ 2 │
28
+ * │ 3 │
29
+ * └───┘
30
+ * >>> df.withColumns($df.col("a").abs().alias("abs_a"))
31
+ * shape: (3, 2)
32
+ * ┌───┬───────┐
33
+ * │ a │ abs_a │
34
+ * ├───┼───────┤
35
+ * │ 1 │ 1 │
36
+ * │ 2 │ 2 │
37
+ * │ 3 │ 3 │
38
+ * └───┴───────┘
39
+ */
40
+ abs(): this;
41
+ /**
42
+ * Adds a scalar value or another column expression.
43
+ * @param val The number or column expression to add.
44
+ * @returns ColumnExpression
45
+ * @example
46
+ * >>> const df = $df.data({ a: [1, 2, 3] })
47
+ * >>> df
48
+ * shape: (3, 1)
49
+ * ┌───┐
50
+ * │ a │
51
+ * ├───┤
52
+ * │ 1 │
53
+ * │ 2 │
54
+ * │ 3 │
55
+ * └───┘
56
+ * >>> df.withColumns($df.col("a").add(10).alias("added"))
57
+ * shape: (3, 2)
58
+ * ┌───┬───────┐
59
+ * │ a │ added │
60
+ * ├───┼───────┤
61
+ * │ 1 │ 11 │
62
+ * │ 2 │ 12 │
63
+ * │ 3 │ 13 │
64
+ * └───┴───────┘
65
+ */
66
+ add(val: NumericArg): this;
67
+ /**
68
+ * Aggregation: Returns true if all values in the group are truthy.
69
+ * @returns ColumnExpression
70
+ * @example
71
+ * >>> const df = $df.data({ a: [true, true, false, false], b: [true, false, true, false] })
72
+ * >>> df
73
+ * shape: (4, 2)
74
+ * ┌───────┬───────┐
75
+ * │ a │ b │
76
+ * ├───────┼───────┤
77
+ * │ true │ true │
78
+ * │ true │ false │
79
+ * │ false │ true │
80
+ * │ false │ false │
81
+ * └───────┴───────┘
82
+ * >>> df.select($df.col("a").all().alias("all_true"))
83
+ * shape: (1, 1)
84
+ * ┌──────────┐
85
+ * │ all_true │
86
+ * ├──────────┤
87
+ * │ false │
88
+ * └──────────┘
89
+ */
90
+ all(): this;
91
+ /**
92
+ * Aggregation: Checks if all values in the group are null.
93
+ * @returns ColumnExpression
94
+ * @example
95
+ * >>> const df = $df.data({ a: [1, null, 3], b: [null, 2, null] })
96
+ * >>> df
97
+ * shape: (3, 2)
98
+ * ┌──────┬──────┐
99
+ * │ a │ b │
100
+ * ├──────┼──────┤
101
+ * │ 1 │ null │
102
+ * │ null │ 2 │
103
+ * │ 3 │ null │
104
+ * └──────┴──────┘
105
+ * >>> df.select($df.col("a").allNull().alias("all_null"))
106
+ * shape: (1, 1)
107
+ * ┌──────────┐
108
+ * │ all_null │
109
+ * ├──────────┤
110
+ * │ false │
111
+ * └──────────┘
112
+ */
113
+ allNull(): this;
114
+ /**
115
+ * Logical AND check supporting Kleene logic.
116
+ * @param other The other boolean column expression or literal value to compare.
117
+ * @returns ColumnExpression
118
+ * @example
119
+ * >>> const df = $df.data({ a: [true, true, false, false], b: [true, false, true, false] })
120
+ * >>> df
121
+ * shape: (4, 2)
122
+ * ┌───────┬───────┐
123
+ * │ a │ b │
124
+ * ├───────┼───────┤
125
+ * │ true │ true │
126
+ * │ true │ false │
127
+ * │ false │ true │
128
+ * │ false │ false │
129
+ * └───────┴───────┘
130
+ * >>> df.withColumns($df.col("a").and($df.col("b")).alias("and_res"))
131
+ * shape: (4, 3)
132
+ * ┌───────┬───────┬─────────┐
133
+ * │ a │ b │ and_res │
134
+ * ├───────┼───────┼─────────┤
135
+ * │ true │ true │ true │
136
+ * │ true │ false │ false │
137
+ * │ false │ false │ false │
138
+ * │ null │ true │ null │
139
+ * └───────┴───────┴─────────┘
140
+ */
141
+ and(other: any): this;
142
+ /**
143
+ * Aggregation: Checks if any value in the group is truthy.
144
+ * @returns ColumnExpression
145
+ * @example
146
+ * >>> const df = $df.data({ a: [true, true, false, false], b: [true, false, true, false] })
147
+ * >>> df
148
+ * shape: (4, 2)
149
+ * ┌───────┬───────┐
150
+ * │ a │ b │
151
+ * ├───────┼───────┤
152
+ * │ true │ true │
153
+ * │ true │ false │
154
+ * │ false │ true │
155
+ * │ false │ false │
156
+ * └───────┴───────┘
157
+ * >>> df.select($df.col("a").any().alias("any_true"))
158
+ * shape: (1, 1)
159
+ * ┌──────────┐
160
+ * │ any_true │
161
+ * ├──────────┤
162
+ * │ true │
163
+ * └──────────┘
164
+ */
165
+ any(): this;
166
+ /**
167
+ * Aggregation: Checks if any value in the group is null.
168
+ * @returns ColumnExpression
169
+ * @example
170
+ * >>> const df = $df.data({ a: [1, null, 3], b: [null, 2, null] })
171
+ * >>> df
172
+ * shape: (3, 2)
173
+ * ┌──────┬──────┐
174
+ * │ a │ b │
175
+ * ├──────┼──────┤
176
+ * │ 1 │ null │
177
+ * │ null │ 2 │
178
+ * │ 3 │ null │
179
+ * └──────┴──────┘
180
+ * >>> df.select($df.col("a").anyNull().alias("has_null"))
181
+ * shape: (1, 1)
182
+ * ┌──────────┐
183
+ * │ has_null │
184
+ * ├──────────┤
185
+ * │ true │
186
+ * └──────────┘
187
+ */
188
+ anyNull(): this;
189
+ /**
190
+ * Computes the mathematical arccosine (inverse cosine) of the column values.
191
+ * @returns ColumnExpression
192
+ * @example
193
+ * >>> const df = $df.data({ a: [1, 2, 3] })
194
+ * >>> df
195
+ * shape: (3, 1)
196
+ * ┌───┐
197
+ * │ a │
198
+ * ├───┤
199
+ * │ 1 │
200
+ * │ 2 │
201
+ * │ 3 │
202
+ * └───┘
203
+ * >>> df.withColumns($df.col("a").arccos().alias("arccos_a"))
204
+ * shape: (3, 2)
205
+ * ┌───┬──────────┐
206
+ * │ a │ arccos_a │
207
+ * ├───┼──────────┤
208
+ * │ 1 │ 0 │
209
+ * │ 2 │ null │
210
+ * │ 3 │ null │
211
+ * └───┴──────────┘
212
+ */
213
+ arccos(): this;
214
+ /**
215
+ * Computes the hyperbolic arccosine of the column values.
216
+ * @returns ColumnExpression
217
+ * @example
218
+ * >>> const df = $df.data({ a: [1, 2, 3] })
219
+ * >>> df
220
+ * shape: (3, 1)
221
+ * ┌───┐
222
+ * │ a │
223
+ * ├───┤
224
+ * │ 1 │
225
+ * │ 2 │
226
+ * │ 3 │
227
+ * └───┘
228
+ * >>> df.withColumns($df.col("a").arccosh().alias("arccosh_a"))
229
+ * shape: (3, 2)
230
+ * ┌───┬───────────┐
231
+ * │ a │ arccosh_a │
232
+ * ├───┼───────────┤
233
+ * │ 1 │ 0 │
234
+ * │ 2 │ 1.316958 │
235
+ * │ 3 │ 1.762747 │
236
+ * └───┴───────────┘
237
+ */
238
+ arccosh(): this;
239
+ /**
240
+ * Computes the arcsine of the column values.
241
+ * @returns ColumnExpression
242
+ * @example
243
+ * >>> const df = $df.data({ a: [1, 2, 3] })
244
+ * >>> df
245
+ * shape: (3, 1)
246
+ * ┌───┐
247
+ * │ a │
248
+ * ├───┤
249
+ * │ 1 │
250
+ * │ 2 │
251
+ * │ 3 │
252
+ * └───┘
253
+ * >>> df.withColumns($df.col("a").arcsin().alias("arcsin_a"))
254
+ * shape: (3, 2)
255
+ * ┌───┬──────────┐
256
+ * │ a │ arcsin_a │
257
+ * ├───┼──────────┤
258
+ * │ 1 │ 1.570796 │
259
+ * │ 2 │ null │
260
+ * │ 3 │ null │
261
+ * └───┴──────────┘
262
+ */
263
+ arcsin(): this;
264
+ /**
265
+ * Computes the hyperbolic arcsine of the column values.
266
+ * @returns ColumnExpression
267
+ * @example
268
+ * >>> const df = $df.data({ a: [1, 2, 3] })
269
+ * >>> df
270
+ * shape: (3, 1)
271
+ * ┌───┐
272
+ * │ a │
273
+ * ├───┤
274
+ * │ 1 │
275
+ * │ 2 │
276
+ * │ 3 │
277
+ * └───┘
278
+ * >>> df.withColumns($df.col("a").arcsinh().alias("arcsinh_a"))
279
+ * shape: (3, 2)
280
+ * ┌───┬───────────┐
281
+ * │ a │ arcsinh_a │
282
+ * ├───┼───────────┤
283
+ * │ 1 │ 0.881374 │
284
+ * │ 2 │ 1.443635 │
285
+ * │ 3 │ 1.818446 │
286
+ * └───┴───────────┘
287
+ */
288
+ arcsinh(): this;
289
+ /**
290
+ * Computes the arctangent of the column values.
291
+ * @returns ColumnExpression
292
+ * @example
293
+ * >>> const df = $df.data({ a: [1, 2, 3] })
294
+ * >>> df
295
+ * shape: (3, 1)
296
+ * ┌───┐
297
+ * │ a │
298
+ * ├───┤
299
+ * │ 1 │
300
+ * │ 2 │
301
+ * │ 3 │
302
+ * └───┘
303
+ * >>> df.withColumns($df.col("a").arctan().alias("arctan_a"))
304
+ * shape: (3, 2)
305
+ * ┌───┬──────────┐
306
+ * │ a │ arctan_a │
307
+ * ├───┼──────────┤
308
+ * │ 1 │ 0.785398 │
309
+ * │ 2 │ 1.107149 │
310
+ * │ 3 │ 1.249046 │
311
+ * └───┴──────────┘
312
+ */
313
+ arctan(): this;
314
+ /**
315
+ * Computes the quadrant-aware arctangent of two values.
316
+ * @param val The x denominator number or column expression.
317
+ * @returns ColumnExpression
318
+ * @example
319
+ * >>> const df = $df.data({ a: [1, 2, 3], b: [10, 20, 30] })
320
+ * >>> df
321
+ * shape: (3, 2)
322
+ * ┌───┬────┐
323
+ * │ a │ b │
324
+ * ├───┼────┤
325
+ * │ 1 │ 10 │
326
+ * │ 2 │ 20 │
327
+ * │ 3 │ 30 │
328
+ * └───┴────┘
329
+ * >>> df.withColumns($df.col("a").arctan2($df.col("b")).alias("arctan2_a"))
330
+ * shape: (3, 3)
331
+ * ┌───┬────┬───────────┐
332
+ * │ a │ b │ arctan2_a │
333
+ * ├───┼────┼───────────┤
334
+ * │ 1 │ 10 │ 0.099669 │
335
+ * │ 2 │ 20 │ 0.099669 │
336
+ * │ 3 │ 30 │ 0.099669 │
337
+ * └───┴────┴───────────┘
338
+ */
339
+ arctan2(val: NumericArg): this;
340
+ /**
341
+ * Computes the hyperbolic arctangent of the column values.
342
+ * @returns ColumnExpression
343
+ * @example
344
+ * >>> const df = $df.data({ a: [1, 2, 3] })
345
+ * >>> df
346
+ * shape: (3, 1)
347
+ * ┌───┐
348
+ * │ a │
349
+ * ├───┤
350
+ * │ 1 │
351
+ * │ 2 │
352
+ * │ 3 │
353
+ * └───┘
354
+ * >>> df.withColumns($df.col("a").arctanh().alias("arctanh_a"))
355
+ * shape: (3, 2)
356
+ * ┌───┬───────────┐
357
+ * │ a │ arctanh_a │
358
+ * ├───┼───────────┤
359
+ * │ 1 │ null │
360
+ * │ 2 │ null │
361
+ * │ 3 │ null │
362
+ * └───┴───────────┘
363
+ */
364
+ arctanh(): this;
365
+ /**
366
+ * Aggregation: Finds the index of the maximum value in the group.
367
+ * @returns ColumnExpression
368
+ * @example
369
+ * >>> const df = $df.data({ a: [1, 2, 3] })
370
+ * >>> df
371
+ * shape: (3, 1)
372
+ * ┌───┐
373
+ * │ a │
374
+ * ├───┤
375
+ * │ 1 │
376
+ * │ 2 │
377
+ * │ 3 │
378
+ * └───┘
379
+ * >>> df.select($df.col("val").argMax().alias("max_idx"))
380
+ * shape: (1, 1)
381
+ * ┌─────────┐
382
+ * │ max_idx │
383
+ * ├─────────┤
384
+ * │ 2 │
385
+ * └─────────┘
386
+ */
387
+ argMax(): this;
388
+ /**
389
+ * Aggregation: Finds the index of the minimum value in the group.
390
+ * @returns ColumnExpression
391
+ * @example
392
+ * >>> const df = $df.data({ a: [1, 2, 3] })
393
+ * >>> df
394
+ * shape: (3, 1)
395
+ * ┌───┐
396
+ * │ a │
397
+ * ├───┤
398
+ * │ 1 │
399
+ * │ 2 │
400
+ * │ 3 │
401
+ * └───┘
402
+ * >>> df.select($df.col("val").argMin().alias("min_idx"))
403
+ * shape: (1, 1)
404
+ * ┌─────────┐
405
+ * │ min_idx │
406
+ * ├─────────┤
407
+ * │ 0 │
408
+ * └─────────┘
409
+ */
410
+ argMin(): this;
411
+ /**
412
+ * Aggregation: Computes the arithmetic mean of the group.
413
+ * @returns ColumnExpression
414
+ * @example
415
+ * >>> const df = $df.data({ group: ["A", "A", "B"], val: [10, 20, 30] })
416
+ * >>> df
417
+ * shape: (3, 2)
418
+ * ┌───────┬─────┐
419
+ * │ group │ val │
420
+ * ├───────┼─────┤
421
+ * │ A │ 10 │
422
+ * │ A │ 20 │
423
+ * │ B │ 30 │
424
+ * └───────┴─────┘
425
+ * >>> df.groupBy("group").agg($df.col("val").avg().alias("mean"))
426
+ * shape: (2, 2)
427
+ * ┌───────┬──────┐
428
+ * │ group │ mean │
429
+ * ├───────┼──────┤
430
+ * │ A │ 15 │
431
+ * │ B │ 30 │
432
+ * └───────┴──────┘
433
+ */
434
+ avg(): this;
435
+ /**
436
+ * Checks if values fall inside lower and upper boundaries (inclusive).
437
+ * @param lower The lower boundary value or expression.
438
+ * @param upper The upper boundary value or expression.
439
+ * @param closed Control boundary inclusivity: "both", "left", "right", or "none" (default: "both").
440
+ * @returns ColumnExpression
441
+ * @example
442
+ * >>> const df = $df.data({ a: [1, 2, 3], b: [10, 20, 30] })
443
+ * >>> df
444
+ * shape: (3, 2)
445
+ * ┌───┬────┐
446
+ * │ a │ b │
447
+ * ├───┼────┤
448
+ * │ 1 │ 10 │
449
+ * │ 2 │ 20 │
450
+ * │ 3 │ 30 │
451
+ * └───┴────┘
452
+ * >>> df.withColumns($df.col("a").between(1, 2).alias("in_range"))
453
+ * shape: (3, 3)
454
+ * ┌───┬────┬──────────┐
455
+ * │ a │ b │ in_range │
456
+ * ├───┼────┼──────────┤
457
+ * │ 1 │ 10 │ true │
458
+ * │ 2 │ 20 │ true │
459
+ * │ 3 │ 30 │ false │
460
+ * └───┴────┴──────────┘
461
+ */
462
+ between(lower: any, upper: any, closed?: "both" | "left" | "right" | "none"): this;
463
+ /**
464
+ * Aggregation: Computes bitwise AND across all elements in the group.
465
+ * @returns ColumnExpression
466
+ * @example
467
+ * >>> const df = $df.data({ a: [1, 2, 3] })
468
+ * >>> df
469
+ * shape: (3, 1)
470
+ * ┌───┐
471
+ * │ a │
472
+ * ├───┤
473
+ * │ 1 │
474
+ * │ 2 │
475
+ * │ 3 │
476
+ * └───┘
477
+ * >>> df.select($df.col("a").bitwiseAnd().alias("res"))
478
+ * shape: (1, 1)
479
+ * ┌─────┐
480
+ * │ res │
481
+ * ├─────┤
482
+ * │ 0 │
483
+ * └─────┘
484
+ */
485
+ bitwiseAnd(): this;
486
+ /**
487
+ * Aggregation: Computes bitwise OR across all elements in the group.
488
+ * @returns ColumnExpression
489
+ * @example
490
+ * >>> const df = $df.data({ a: [1, 2, 3] })
491
+ * >>> df
492
+ * shape: (3, 1)
493
+ * ┌───┐
494
+ * │ a │
495
+ * ├───┤
496
+ * │ 1 │
497
+ * │ 2 │
498
+ * │ 3 │
499
+ * └───┘
500
+ * >>> df.select($df.col("a").bitwiseOr().alias("res"))
501
+ * shape: (1, 1)
502
+ * ┌─────┐
503
+ * │ res │
504
+ * ├─────┤
505
+ * │ 3 │
506
+ * └─────┘
507
+ */
508
+ bitwiseOr(): this;
509
+ /**
510
+ * Aggregation: Computes bitwise XOR across all elements in the group.
511
+ * @returns ColumnExpression
512
+ * @example
513
+ * >>> const df = $df.data({ a: [1, 2, 3] })
514
+ * >>> df
515
+ * shape: (3, 1)
516
+ * ┌───┐
517
+ * │ a │
518
+ * ├───┤
519
+ * │ 1 │
520
+ * │ 2 │
521
+ * │ 3 │
522
+ * └───┘
523
+ * >>> df.select($df.col("a").bitwiseXor().alias("res"))
524
+ * shape: (1, 1)
525
+ * ┌─────┐
526
+ * │ res │
527
+ * ├─────┤
528
+ * │ 0 │
529
+ * └─────┘
530
+ */
531
+ bitwiseXor(): this;
532
+ /**
533
+ * Computes the cube root of the column values.
534
+ * @returns ColumnExpression
535
+ * @example
536
+ * >>> const df = $df.data({ a: [1, 2, 3] })
537
+ * >>> df
538
+ * shape: (3, 1)
539
+ * ┌───┐
540
+ * │ a │
541
+ * ├───┤
542
+ * │ 1 │
543
+ * │ 2 │
544
+ * │ 3 │
545
+ * └───┘
546
+ * >>> df.withColumns($df.col("a").cbrt().alias("cbrt_a"))
547
+ * shape: (3, 2)
548
+ * ┌───┬──────────┐
549
+ * │ a │ cbrt_a │
550
+ * ├───┼──────────┤
551
+ * │ 1 │ 1 │
552
+ * │ 2 │ 1.259921 │
553
+ * │ 3 │ 1.44225 │
554
+ * └───┴──────────┘
555
+ */
556
+ cbrt(): this;
557
+ /**
558
+ * Rounds column values up to the nearest integer.
559
+ * @returns ColumnExpression
560
+ * @example
561
+ * >>> const df = $df.data({ a: [1, 2, 3] })
562
+ * >>> df
563
+ * shape: (3, 1)
564
+ * ┌───┐
565
+ * │ a │
566
+ * ├───┤
567
+ * │ 1 │
568
+ * │ 2 │
569
+ * │ 3 │
570
+ * └───┘
571
+ * >>> df.withColumns($df.col("a").ceil().alias("ceil_a"))
572
+ * shape: (3, 2)
573
+ * ┌───┬────────┐
574
+ * │ a │ ceil_a │
575
+ * ├───┼────────┤
576
+ * │ 1 │ 1 │
577
+ * │ 2 │ 2 │
578
+ * │ 3 │ 3 │
579
+ * └───┴────────┘
580
+ */
581
+ ceil(): this;
582
+ /**
583
+ * Clamps column values between lower and upper numeric thresholds.
584
+ * @param lower The lower threshold value (default: null).
585
+ * @param upper The upper threshold value (default: null).
586
+ * @returns ColumnExpression
587
+ * @example
588
+ * >>> const df = $df.data({ a: [1, 2, 3] })
589
+ * >>> df
590
+ * shape: (3, 1)
591
+ * ┌───┐
592
+ * │ a │
593
+ * ├───┤
594
+ * │ 1 │
595
+ * │ 2 │
596
+ * │ 3 │
597
+ * └───┘
598
+ * >>> df.withColumns($df.col("a").clip(2, 3).alias("clipped"))
599
+ * shape: (3, 2)
600
+ * ┌───┬─────────┐
601
+ * │ a │ clipped │
602
+ * ├───┼─────────┤
603
+ * │ 1 │ 2 │
604
+ * │ 2 │ 2 │
605
+ * │ 3 │ 3 │
606
+ * └───┴─────────┘
607
+ */
608
+ clip(lower?: number | null, upper?: number | null): this;
609
+ /**
610
+ * Returns absolute value of expr with the sign of other.
611
+ * @param val The sign source value or column expression.
612
+ * @returns ColumnExpression
613
+ * @example
614
+ * >>> const df = $df.data({ a: [1, 2, 3], b: [10, 20, 30] })
615
+ * >>> df
616
+ * shape: (3, 2)
617
+ * ┌───┬────┐
618
+ * │ a │ b │
619
+ * ├───┼────┤
620
+ * │ 1 │ 10 │
621
+ * │ 2 │ 20 │
622
+ * │ 3 │ 30 │
623
+ * └───┴────┘
624
+ * >>> df.withColumns($df.col("a").copysign($df.col("b")).alias("signed"))
625
+ * shape: (3, 3)
626
+ * ┌───┬────┬────────┐
627
+ * │ a │ b │ signed │
628
+ * ├───┼────┼────────┤
629
+ * │ 1 │ 10 │ 1 │
630
+ * │ 2 │ 20 │ 2 │
631
+ * │ 3 │ 30 │ 3 │
632
+ * └───┴────┴────────┘
633
+ */
634
+ copysign(val: NumericArg): this;
635
+ /**
636
+ * Aggregation: Computes the Pearson correlation coefficient between two columns.
637
+ * @param other The target column expression to correlate with.
638
+ * @returns ColumnExpression
639
+ * @example
640
+ * >>> const df = $df.data({ a: [1, 2, 3], b: [10, 20, 30] })
641
+ * >>> df
642
+ * shape: (3, 2)
643
+ * ┌───┬────┐
644
+ * │ a │ b │
645
+ * ├───┼────┤
646
+ * │ 1 │ 10 │
647
+ * │ 2 │ 20 │
648
+ * │ 3 │ 30 │
649
+ * └───┴────┘
650
+ * >>> df.select($df.col("a").corr($df.col("b")).alias("correlation"))
651
+ * shape: (1, 1)
652
+ * ┌─────────────┐
653
+ * │ correlation │
654
+ * ├─────────────┤
655
+ * │ 1 │
656
+ * └─────────────┘
657
+ */
658
+ corr(other: any): this;
659
+ /**
660
+ * Computes the cosine of the column values.
661
+ * @returns ColumnExpression
662
+ * @example
663
+ * >>> const df = $df.data({ a: [1, 2, 3] })
664
+ * >>> df
665
+ * shape: (3, 1)
666
+ * ┌───┐
667
+ * │ a │
668
+ * ├───┤
669
+ * │ 1 │
670
+ * │ 2 │
671
+ * │ 3 │
672
+ * └───┘
673
+ * >>> df.withColumns($df.col("a").cos().alias("cos_a"))
674
+ * shape: (3, 2)
675
+ * ┌───┬───────────┐
676
+ * │ a │ cos_a │
677
+ * ├───┼───────────┤
678
+ * │ 1 │ 0.540302 │
679
+ * │ 2 │ -0.416147 │
680
+ * │ 3 │ -0.989992 │
681
+ * └───┴───────────┘
682
+ */
683
+ cos(): this;
684
+ /**
685
+ * Computes the hyperbolic cosine of the column values.
686
+ * @returns ColumnExpression
687
+ * @example
688
+ * >>> const df = $df.data({ a: [1, 2, 3] })
689
+ * >>> df
690
+ * shape: (3, 1)
691
+ * ┌───┐
692
+ * │ a │
693
+ * ├───┤
694
+ * │ 1 │
695
+ * │ 2 │
696
+ * │ 3 │
697
+ * └───┘
698
+ * >>> df.withColumns($df.col("a").cosh().alias("cosh_a"))
699
+ * shape: (3, 2)
700
+ * ┌───┬───────────┐
701
+ * │ a │ cosh_a │
702
+ * ├───┼───────────┤
703
+ * │ 1 │ 1.543081 │
704
+ * │ 2 │ 3.762196 │
705
+ * │ 3 │ 10.067662 │
706
+ * └───┴───────────┘
707
+ */
708
+ cosh(): this;
709
+ /**
710
+ * Computes the cotangent of the column values.
711
+ * @returns ColumnExpression
712
+ * @example
713
+ * >>> const df = $df.data({ a: [1, 2, 3] })
714
+ * >>> df
715
+ * shape: (3, 1)
716
+ * ┌───┐
717
+ * │ a │
718
+ * ├───┤
719
+ * │ 1 │
720
+ * │ 2 │
721
+ * │ 3 │
722
+ * └───┘
723
+ * >>> df.withColumns($df.col("a").cot().alias("cot_a"))
724
+ * shape: (3, 2)
725
+ * ┌───┬───────────┐
726
+ * │ a │ cot_a │
727
+ * ├───┼───────────┤
728
+ * │ 1 │ 0.642093 │
729
+ * │ 2 │ -0.457658 │
730
+ * │ 3 │ -7.015253 │
731
+ * └───┴───────────┘
732
+ */
733
+ cot(): this;
734
+ /**
735
+ * Aggregation: Returns the count of records inside the group.
736
+ * @param options Config flags including whether to count null values.
737
+ * @returns ColumnExpression
738
+ * @example
739
+ * >>> const df = $df.data({ group: ["A", "A", "B"], val: [10, 20, 30] })
740
+ * >>> df
741
+ * shape: (3, 2)
742
+ * ┌───────┬─────┐
743
+ * │ group │ val │
744
+ * ├───────┼─────┤
745
+ * │ A │ 10 │
746
+ * │ A │ 20 │
747
+ * │ B │ 30 │
748
+ * └───────┴─────┘
749
+ * >>> df.groupBy("group").agg($df.col("val").count().alias("cnt"))
750
+ * shape: (2, 2)
751
+ * ┌───────┬─────┐
752
+ * │ group │ cnt │
753
+ * ├───────┼─────┤
754
+ * │ A │ 2 │
755
+ * │ B │ 1 │
756
+ * └───────┴─────┘
757
+ */
758
+ count(options?: {
759
+ includeNulls?: boolean;
760
+ }): this;
761
+ /**
762
+ * Aggregation: Computes the covariance between two columns.
763
+ * @param other The target column expression to compute covariance with.
764
+ * @returns ColumnExpression
765
+ * @example
766
+ * >>> const df = $df.data({ a: [1, 2, 3], b: [10, 20, 30] })
767
+ * >>> df
768
+ * shape: (3, 2)
769
+ * ┌───┬────┐
770
+ * │ a │ b │
771
+ * ├───┼────┤
772
+ * │ 1 │ 10 │
773
+ * │ 2 │ 20 │
774
+ * │ 3 │ 30 │
775
+ * └───┴────┘
776
+ * >>> df.select($df.col("a").cov($df.col("b")).alias("covariance"))
777
+ * shape: (1, 1)
778
+ * ┌────────────┐
779
+ * │ covariance │
780
+ * ├────────────┤
781
+ * │ 10 │
782
+ * └────────────┘
783
+ */
784
+ cov(other: any): this;
785
+ /**
786
+ * Window: Computes cumulative count.
787
+ * @param reverse Flag indicating whether to compute from reverse direction.
788
+ * @returns ColumnExpression
789
+ * @example
790
+ * >>> const df = $df.data({ a: [1, 2, 3] })
791
+ * >>> df
792
+ * shape: (3, 1)
793
+ * ┌───┐
794
+ * │ a │
795
+ * ├───┤
796
+ * │ 1 │
797
+ * │ 2 │
798
+ * │ 3 │
799
+ * └───┘
800
+ * >>> df.withColumns($df.col("val").cumCount().alias("c_count"))
801
+ * shape: (3, 2)
802
+ * ┌─────┬─────────┐
803
+ * │ val │ c_count │
804
+ * ├─────┼─────────┤
805
+ * │ 10 │ 1 │
806
+ * │ 20 │ 2 │
807
+ * │ 30 │ 3 │
808
+ * └─────┴─────────┘
809
+ */
810
+ cumCount(reverse?: boolean): this;
811
+ /**
812
+ * Window: Computes cumulative maximum value.
813
+ * @param reverse Flag indicating whether to compute in reverse direction.
814
+ * @returns ColumnExpression
815
+ * @example
816
+ * >>> const df = $df.data({ a: [1, 2, 3] })
817
+ * >>> df
818
+ * shape: (3, 1)
819
+ * ┌───┐
820
+ * │ a │
821
+ * ├───┤
822
+ * │ 1 │
823
+ * │ 2 │
824
+ * │ 3 │
825
+ * └───┘
826
+ * >>> df.withColumns($df.col("val").cumMax().alias("c_max"))
827
+ * shape: (3, 2)
828
+ * ┌─────┬───────┐
829
+ * │ val │ c_max │
830
+ * ├─────┼───────┤
831
+ * │ 10 │ 10 │
832
+ * │ 20 │ 20 │
833
+ * │ 30 │ 30 │
834
+ * └─────┴───────┘
835
+ */
836
+ cumMax(reverse?: boolean): this;
837
+ /**
838
+ * Window: Computes cumulative minimum value.
839
+ * @param reverse Flag indicating whether to compute in reverse direction.
840
+ * @returns ColumnExpression
841
+ * @example
842
+ * >>> const df = $df.data({ a: [1, 2, 3] })
843
+ * >>> df
844
+ * shape: (3, 1)
845
+ * ┌───┐
846
+ * │ a │
847
+ * ├───┤
848
+ * │ 1 │
849
+ * │ 2 │
850
+ * │ 3 │
851
+ * └───┘
852
+ * >>> df.withColumns($df.col("val").cumMin().alias("c_min"))
853
+ * shape: (3, 2)
854
+ * ┌─────┬───────┐
855
+ * │ val │ c_min │
856
+ * ├─────┼───────┤
857
+ * │ 10 │ 10 │
858
+ * │ 20 │ 10 │
859
+ * │ 30 │ 10 │
860
+ * └─────┴───────┘
861
+ */
862
+ cumMin(reverse?: boolean): this;
863
+ /**
864
+ * Window: Computes cumulative product of values.
865
+ * @param reverse Flag indicating whether to compute in reverse direction.
866
+ * @returns ColumnExpression
867
+ * @example
868
+ * >>> const df = $df.data({ a: [1, 2, 3] })
869
+ * >>> df
870
+ * shape: (3, 1)
871
+ * ┌───┐
872
+ * │ a │
873
+ * ├───┤
874
+ * │ 1 │
875
+ * │ 2 │
876
+ * │ 3 │
877
+ * └───┘
878
+ * >>> df.withColumns($df.col("a").cumProd().alias("c_prod"))
879
+ * shape: (4, 2)
880
+ * ┌───┬────────┐
881
+ * │ a │ c_prod │
882
+ * ├───┼────────┤
883
+ * │ 1 │ 1 │
884
+ * │ 2 │ 2 │
885
+ * │ 3 │ 6 │
886
+ * │ 4 │ 24 │
887
+ * └───┴────────┘
888
+ */
889
+ cumProd(reverse?: boolean): this;
890
+ /**
891
+ * Window: Computes cumulative sum of values.
892
+ * @param reverse Flag indicating whether to compute in reverse direction.
893
+ * @returns ColumnExpression
894
+ * @example
895
+ * >>> const df = $df.data({ a: [1, 2, 3] })
896
+ * >>> df
897
+ * shape: (3, 1)
898
+ * ┌───┐
899
+ * │ a │
900
+ * ├───┤
901
+ * │ 1 │
902
+ * │ 2 │
903
+ * │ 3 │
904
+ * └───┘
905
+ * >>> df.withColumns($df.col("val").cumSum().alias("c_sum"))
906
+ * shape: (3, 2)
907
+ * ┌─────┬───────┐
908
+ * │ val │ c_sum │
909
+ * ├─────┼───────┤
910
+ * │ 10 │ 10 │
911
+ * │ 20 │ 30 │
912
+ * │ 30 │ 60 │
913
+ * └─────┴───────┘
914
+ */
915
+ cumSum(reverse?: boolean): this;
916
+ /**
917
+ * Converts angles from radians to degrees.
918
+ * @returns ColumnExpression
919
+ * @example
920
+ * >>> const df = $df.data({ a: [1, 2, 3] })
921
+ * >>> df
922
+ * shape: (3, 1)
923
+ * ┌───┐
924
+ * │ a │
925
+ * ├───┤
926
+ * │ 1 │
927
+ * │ 2 │
928
+ * │ 3 │
929
+ * └───┘
930
+ * >>> df.withColumns($df.col("a").degrees().alias("deg"))
931
+ * shape: (3, 2)
932
+ * ┌───┬────────────┐
933
+ * │ a │ deg │
934
+ * ├───┼────────────┤
935
+ * │ 1 │ 57.29578 │
936
+ * │ 2 │ 114.591559 │
937
+ * │ 3 │ 171.887339 │
938
+ * └───┴────────────┘
939
+ */
940
+ degrees(): this;
941
+ /**
942
+ * Window: Computes dense rank (ranks without gaps) within group partition.
943
+ * @returns ColumnExpression
944
+ * @example
945
+ * >>> const df = $df.data({ a: [1, 2, 3] })
946
+ * >>> df
947
+ * shape: (3, 1)
948
+ * ┌───┐
949
+ * │ a │
950
+ * ├───┤
951
+ * │ 1 │
952
+ * │ 2 │
953
+ * │ 3 │
954
+ * └───┘
955
+ * >>> df.withColumns($df.col("score").denseRank().alias("dr"))
956
+ * shape: (2, 2)
957
+ * ┌───────┬────┐
958
+ * │ score │ dr │
959
+ * ├───────┼────┤
960
+ * │ 75 │ 1 │
961
+ * │ 95 │ 2 │
962
+ * └───────┴────┘
963
+ */
964
+ denseRank(): this;
965
+ /**
966
+ * Divides column values by a scalar or another column expression.
967
+ * @param val The denominator value or column expression.
968
+ * @returns ColumnExpression
969
+ * @example
970
+ * >>> const df = $df.data({ a: [1, 2, 3] })
971
+ * >>> df
972
+ * shape: (3, 1)
973
+ * ┌───┐
974
+ * │ a │
975
+ * ├───┤
976
+ * │ 1 │
977
+ * │ 2 │
978
+ * │ 3 │
979
+ * └───┘
980
+ * >>> df.withColumns($df.col("a").div(2).alias("div_a"))
981
+ * shape: (3, 2)
982
+ * ┌───┬───────┐
983
+ * │ a │ div_a │
984
+ * ├───┼───────┤
985
+ * │ 1 │ 0.5 │
986
+ * │ 2 │ 1 │
987
+ * │ 3 │ 1.5 │
988
+ * └───┴───────┘
989
+ */
990
+ div(val: NumericArg): this;
991
+ /**
992
+ * Aggregation: Computes the dot product with another column.
993
+ * @param other The other column expression to compute the dot product with.
994
+ * @returns ColumnExpression
995
+ * @example
996
+ * >>> const df = $df.data({ a: [1, 2, 3], b: [10, 20, 30] })
997
+ * >>> df
998
+ * shape: (3, 2)
999
+ * ┌───┬────┐
1000
+ * │ a │ b │
1001
+ * ├───┼────┤
1002
+ * │ 1 │ 10 │
1003
+ * │ 2 │ 20 │
1004
+ * │ 3 │ 30 │
1005
+ * └───┴────┘
1006
+ * >>> df.select($df.col("a").dot($df.col("b")).alias("dot_product"))
1007
+ * shape: (1, 1)
1008
+ * ┌─────────────┐
1009
+ * │ dot_product │
1010
+ * ├─────────────┤
1011
+ * │ 140 │
1012
+ * └─────────────┘
1013
+ */
1014
+ dot(other: any): this;
1015
+ /**
1016
+ * Aggregation: Computes the Shannon entropy of a column or group.
1017
+ * @param options Entropy options ({ base?: number, normalize?: boolean }, default base=Math.E, normalize=true).
1018
+ * @returns ColumnExpression
1019
+ * @example
1020
+ * >>> const df = $df.data({ a: [1, 2, 3] })
1021
+ * >>> df
1022
+ * shape: (3, 1)
1023
+ * ┌───┐
1024
+ * │ a │
1025
+ * ├───┤
1026
+ * │ 1 │
1027
+ * │ 2 │
1028
+ * │ 3 │
1029
+ * └───┘
1030
+ * >>> df.select($df.col("a").entropy().alias("h"))
1031
+ * shape: (1, 1)
1032
+ * ┌──────────┐
1033
+ * │ h │
1034
+ * ├──────────┤
1035
+ * │ 1.386294 │
1036
+ * └──────────┘
1037
+ */
1038
+ entropy(options?: EntropyOptions): this;
1039
+ /**
1040
+ * Boolean comparison: Returns true if column values match the specified value exactly.
1041
+ * @param val The value or column expression to compare against.
1042
+ * @returns ColumnExpression
1043
+ * @example
1044
+ * >>> const df = $df.data({ a: [1, 2, 3] })
1045
+ * >>> df
1046
+ * shape: (3, 1)
1047
+ * ┌───┐
1048
+ * │ a │
1049
+ * ├───┤
1050
+ * │ 1 │
1051
+ * │ 2 │
1052
+ * │ 3 │
1053
+ * └───┘
1054
+ * >>> df.withColumns($df.col("a").eq(2).alias("is_two"))
1055
+ * shape: (3, 2)
1056
+ * ┌───┬────────┐
1057
+ * │ a │ is_two │
1058
+ * ├───┼────────┤
1059
+ * │ 1 │ false │
1060
+ * │ 2 │ true │
1061
+ * │ 3 │ false │
1062
+ * └───┴────────┘
1063
+ */
1064
+ eq(val: any): this;
1065
+ /**
1066
+ * Equivalence check that treats null values as equal to each other.
1067
+ * @param val The value or column expression to compare against.
1068
+ * @returns ColumnExpression
1069
+ * @example
1070
+ * >>> const df = $df.data({ a: [1, null, 3], b: [null, 2, null] })
1071
+ * >>> df
1072
+ * shape: (3, 2)
1073
+ * ┌──────┬──────┐
1074
+ * │ a │ b │
1075
+ * ├──────┼──────┤
1076
+ * │ 1 │ null │
1077
+ * │ null │ 2 │
1078
+ * │ 3 │ null │
1079
+ * └──────┴──────┘
1080
+ * >>> df.withColumns($df.col("a").eqMissing(null).alias("is_missing"))
1081
+ * shape: (3, 2)
1082
+ * ┌──────┬────────────┐
1083
+ * │ a │ is_missing │
1084
+ * ├──────┼────────────┤
1085
+ * │ 1 │ false │
1086
+ * │ null │ true │
1087
+ * │ 3 │ false │
1088
+ * └──────┴────────────┘
1089
+ */
1090
+ eqMissing(val: any): this;
1091
+ /**
1092
+ * Computes natural exponent (e^x) of the column values.
1093
+ * @returns ColumnExpression
1094
+ * @example
1095
+ * >>> const df = $df.data({ a: [1, 2, 3] })
1096
+ * >>> df
1097
+ * shape: (3, 1)
1098
+ * ┌───┐
1099
+ * │ a │
1100
+ * ├───┤
1101
+ * │ 1 │
1102
+ * │ 2 │
1103
+ * │ 3 │
1104
+ * └───┘
1105
+ * >>> df.withColumns($df.col("a").exp().alias("exp_a"))
1106
+ * shape: (3, 2)
1107
+ * ┌───┬───────────┐
1108
+ * │ a │ exp_a │
1109
+ * ├───┼───────────┤
1110
+ * │ 1 │ 2.718282 │
1111
+ * │ 2 │ 7.389056 │
1112
+ * │ 3 │ 20.085537 │
1113
+ * └───┴───────────┘
1114
+ */
1115
+ exp(): this;
1116
+ /**
1117
+ * Computes e^x - 1 for each element in the column.
1118
+ * @returns ColumnExpression
1119
+ * @example
1120
+ * >>> const df = $df.data({ a: [1, 2, 3] })
1121
+ * >>> df
1122
+ * shape: (3, 1)
1123
+ * ┌───┐
1124
+ * │ a │
1125
+ * ├───┤
1126
+ * │ 1 │
1127
+ * │ 2 │
1128
+ * │ 3 │
1129
+ * └───┘
1130
+ * >>> df.withColumns($df.col("a").expm1().alias("expm1_a"))
1131
+ * shape: (3, 2)
1132
+ * ┌───┬───────────┐
1133
+ * │ a │ expm1_a │
1134
+ * ├───┼───────────┤
1135
+ * │ 1 │ 1.718282 │
1136
+ * │ 2 │ 6.389056 │
1137
+ * │ 3 │ 19.085537 │
1138
+ * └───┴───────────┘
1139
+ */
1140
+ expm1(): this;
1141
+ /**
1142
+ * Replaces null, undefined, or missing values with a specified value or strategy.
1143
+ * @param options Configuration options including fill value, strategy ("forward", "backward", "zero", "one", "mean", "min", "max"), and optional limit.
1144
+ * @returns ColumnExpression
1145
+ * @example
1146
+ * >>> const df = $df.data({ a: [1, null, 3], b: [null, 2, null] })
1147
+ * >>> df
1148
+ * shape: (3, 2)
1149
+ * ┌──────┬──────┐
1150
+ * │ a │ b │
1151
+ * ├──────┼──────┤
1152
+ * │ 1 │ null │
1153
+ * │ null │ 2 │
1154
+ * │ 3 │ null │
1155
+ * └──────┴──────┘
1156
+ * >>> df.withColumns($df.col("a").fillNull({ value: 0 }).alias("filled"))
1157
+ * shape: (3, 2)
1158
+ * ┌──────┬────────┐
1159
+ * │ a │ filled │
1160
+ * ├──────┼────────┤
1161
+ * │ 1 │ 1 │
1162
+ * │ null │ 0 │
1163
+ * │ 3 │ 3 │
1164
+ * └──────┴────────┘
1165
+ */
1166
+ fillNull({ value, strategy, limit }?: FillNullOptions): this;
1167
+ /**
1168
+ * Filters elements of the column expression where the predicate evaluates to truthy.
1169
+ * @param predicate Boolean column expression used to filter values.
1170
+ * @returns ColumnExpression
1171
+ * @example
1172
+ * >>> const df = $df.data({ a: [1, 2, 3] })
1173
+ * >>> df
1174
+ * shape: (3, 1)
1175
+ * ┌───┐
1176
+ * │ a │
1177
+ * ├───┤
1178
+ * │ 1 │
1179
+ * │ 2 │
1180
+ * │ 3 │
1181
+ * └───┘
1182
+ * >>> df.select($df.col("a").filter($df.col("a").gt(1)).alias("filtered"))
1183
+ * shape: (2, 1)
1184
+ * ┌──────────┐
1185
+ * │ filtered │
1186
+ * ├──────────┤
1187
+ * │ 2 │
1188
+ * │ 3 │
1189
+ * └──────────┘
1190
+ */
1191
+ filter(predicate: IExpr): this;
1192
+ /**
1193
+ * Aggregation: Finds the first value in the group.
1194
+ * @returns ColumnExpression
1195
+ * @example
1196
+ * >>> const df = $df.data({ group: ["A", "A", "B"], val: [10, 20, 30] })
1197
+ * >>> df
1198
+ * shape: (3, 2)
1199
+ * ┌───────┬─────┐
1200
+ * │ group │ val │
1201
+ * ├───────┼─────┤
1202
+ * │ A │ 10 │
1203
+ * │ A │ 20 │
1204
+ * │ B │ 30 │
1205
+ * └───────┴─────┘
1206
+ * >>> df.groupBy("group").agg($df.col("val").first().alias("first_val"))
1207
+ * shape: (2, 2)
1208
+ * ┌───────┬───────────┐
1209
+ * │ group │ first_val │
1210
+ * ├───────┼───────────┤
1211
+ * │ A │ 10 │
1212
+ * │ B │ 30 │
1213
+ * └───────┴───────────┘
1214
+ */
1215
+ first(): this;
1216
+ /**
1217
+ * Rounds column values down to the nearest integer.
1218
+ * @returns ColumnExpression
1219
+ * @example
1220
+ * >>> const df = $df.data({ a: [1, 2, 3] })
1221
+ * >>> df
1222
+ * shape: (3, 1)
1223
+ * ┌───┐
1224
+ * │ a │
1225
+ * ├───┤
1226
+ * │ 1 │
1227
+ * │ 2 │
1228
+ * │ 3 │
1229
+ * └───┘
1230
+ * >>> df.withColumns($df.col("a").floor().alias("floor_a"))
1231
+ * shape: (3, 2)
1232
+ * ┌───┬─────────┐
1233
+ * │ a │ floor_a │
1234
+ * ├───┼─────────┤
1235
+ * │ 1 │ 1 │
1236
+ * │ 2 │ 2 │
1237
+ * │ 3 │ 3 │
1238
+ * └───┴─────────┘
1239
+ */
1240
+ floor(): this;
1241
+ /**
1242
+ * Performs integer division floor(x / y) on column values.
1243
+ * @param val The divisor value or column expression.
1244
+ * @returns ColumnExpression
1245
+ * @example
1246
+ * >>> const df = $df.data({ a: [1, 2, 3] })
1247
+ * >>> df
1248
+ * shape: (3, 1)
1249
+ * ┌───┐
1250
+ * │ a │
1251
+ * ├───┤
1252
+ * │ 1 │
1253
+ * │ 2 │
1254
+ * │ 3 │
1255
+ * └───┘
1256
+ * >>> df.withColumns($df.col("a").floordiv(2).alias("fdiv"))
1257
+ * shape: (3, 2)
1258
+ * ┌───┬──────┐
1259
+ * │ a │ fdiv │
1260
+ * ├───┼──────┤
1261
+ * │ 1 │ 0 │
1262
+ * │ 2 │ 1 │
1263
+ * │ 3 │ 1 │
1264
+ * └───┴──────┘
1265
+ */
1266
+ floordiv(val: NumericArg): this;
1267
+ /**
1268
+ * Boolean comparison: Returns true if greater than or equal to argument.
1269
+ * @param val The value or column expression to compare against.
1270
+ * @returns ColumnExpression
1271
+ * @example
1272
+ * >>> const df = $df.data({ a: [1, 2, 3] })
1273
+ * >>> df
1274
+ * shape: (3, 1)
1275
+ * ┌───┐
1276
+ * │ a │
1277
+ * ├───┤
1278
+ * │ 1 │
1279
+ * │ 2 │
1280
+ * │ 3 │
1281
+ * └───┘
1282
+ * >>> df.withColumns($df.col("a").ge(2).alias("ge_two"))
1283
+ * shape: (3, 2)
1284
+ * ┌───┬────────┐
1285
+ * │ a │ ge_two │
1286
+ * ├───┼────────┤
1287
+ * │ 1 │ false │
1288
+ * │ 2 │ true │
1289
+ * │ 3 │ true │
1290
+ * └───┴────────┘
1291
+ */
1292
+ ge(val: any): this;
1293
+ /**
1294
+ * Boolean comparison: Returns true if column value is greater than argument.
1295
+ * @param val The value or column expression to compare against.
1296
+ * @returns ColumnExpression
1297
+ * @example
1298
+ * >>> const df = $df.data({ a: [1, 2, 3] })
1299
+ * >>> df
1300
+ * shape: (3, 1)
1301
+ * ┌───┐
1302
+ * │ a │
1303
+ * ├───┤
1304
+ * │ 1 │
1305
+ * │ 2 │
1306
+ * │ 3 │
1307
+ * └───┘
1308
+ * >>> df.withColumns($df.col("a").gt(2).alias("gt_two"))
1309
+ * shape: (3, 2)
1310
+ * ┌───┬────────┐
1311
+ * │ a │ gt_two │
1312
+ * ├───┼────────┤
1313
+ * │ 1 │ false │
1314
+ * │ 2 │ false │
1315
+ * │ 3 │ true │
1316
+ * └───┴────────┘
1317
+ */
1318
+ gt(val: any): this;
1319
+ /**
1320
+ * Aggregation: Checks if any value in the group is null.
1321
+ * @returns ColumnExpression
1322
+ * @example
1323
+ * >>> const df = $df.data({ a: [1, null, 3], b: [null, 2, null] })
1324
+ * >>> df
1325
+ * shape: (3, 2)
1326
+ * ┌──────┬──────┐
1327
+ * │ a │ b │
1328
+ * ├──────┼──────┤
1329
+ * │ 1 │ null │
1330
+ * │ null │ 2 │
1331
+ * │ 3 │ null │
1332
+ * └──────┴──────┘
1333
+ * >>> df.select($df.col("a").hasNulls().alias("has_nulls"))
1334
+ * shape: (1, 1)
1335
+ * ┌───────────┐
1336
+ * │ has_nulls │
1337
+ * ├───────────┤
1338
+ * │ true │
1339
+ * └───────────┘
1340
+ */
1341
+ hasNulls(): this;
1342
+ /**
1343
+ * Computes the hypotenuse sqrt(x^2 + y^2) of two values.
1344
+ * @param val The other numeric value or column expression.
1345
+ * @returns ColumnExpression
1346
+ * @example
1347
+ * >>> const df = $df.data({ a: [1, 2, 3], b: [10, 20, 30] })
1348
+ * >>> df
1349
+ * shape: (3, 2)
1350
+ * ┌───┬────┐
1351
+ * │ a │ b │
1352
+ * ├───┼────┤
1353
+ * │ 1 │ 10 │
1354
+ * │ 2 │ 20 │
1355
+ * │ 3 │ 30 │
1356
+ * └───┴────┘
1357
+ * >>> df.withColumns($df.col("a").hypot($df.col("b")).alias("hypot_a"))
1358
+ * shape: (3, 3)
1359
+ * ┌───┬────┬───────────┐
1360
+ * │ a │ b │ hypot_a │
1361
+ * ├───┼────┼───────────┤
1362
+ * │ 1 │ 10 │ 10.049876 │
1363
+ * │ 2 │ 20 │ 20.099751 │
1364
+ * │ 3 │ 30 │ 30.149627 │
1365
+ * └───┴────┴───────────┘
1366
+ */
1367
+ hypot(val: NumericArg): this;
1368
+ /**
1369
+ * Aggregation: Combines all values in the group into a single array/list cell.
1370
+ * @returns ColumnExpression
1371
+ * @example
1372
+ * >>> const df = $df.data({ group: ["A", "A", "B"], val: [10, 20, 30] })
1373
+ * >>> df
1374
+ * shape: (3, 2)
1375
+ * ┌───────┬─────┐
1376
+ * │ group │ val │
1377
+ * ├───────┼─────┤
1378
+ * │ A │ 10 │
1379
+ * │ A │ 20 │
1380
+ * │ B │ 30 │
1381
+ * └───────┴─────┘
1382
+ * >>> df.groupBy("group").agg($df.col("val").implode().alias("list_val"))
1383
+ * shape: (2, 2)
1384
+ * ┌───────┬──────────┐
1385
+ * │ group │ list_val │
1386
+ * ├───────┼──────────┤
1387
+ * │ A │ [10, 20] │
1388
+ * │ B │ [30] │
1389
+ * └───────┴──────────┘
1390
+ */
1391
+ implode(): this;
1392
+ /**
1393
+ * Determines if floating-point values are approximately equal within tolerances.
1394
+ * @param other The value or expression to compare against.
1395
+ * @param options Tolerance values absolute (absTol) and relative (relTol), and NaN options.
1396
+ * @returns ColumnExpression
1397
+ * @example
1398
+ * >>> const df = $df.data({ a: [1, 2, 3] })
1399
+ * >>> df
1400
+ * shape: (3, 1)
1401
+ * ┌───┐
1402
+ * │ a │
1403
+ * ├───┤
1404
+ * │ 1 │
1405
+ * │ 2 │
1406
+ * │ 3 │
1407
+ * └───┘
1408
+ * >>> df.withColumns($df.col("a").isClose(1.0).alias("close"))
1409
+ * shape: (3, 2)
1410
+ * ┌───┬───────┐
1411
+ * │ a │ close │
1412
+ * ├───┼───────┤
1413
+ * │ 1 │ true │
1414
+ * │ 2 │ false │
1415
+ * │ 3 │ false │
1416
+ * └───┴───────┘
1417
+ */
1418
+ isClose(other: any, { absTol, relTol, nansEqual }?: IsCloseOptions): this;
1419
+ /**
1420
+ * Checks if values occur more than once in the column.
1421
+ * @returns ColumnExpression
1422
+ * @example
1423
+ * >>> const df = $df.data({ a: [1, 2, 3] })
1424
+ * >>> df
1425
+ * shape: (3, 1)
1426
+ * ┌───┐
1427
+ * │ a │
1428
+ * ├───┤
1429
+ * │ 1 │
1430
+ * │ 2 │
1431
+ * │ 3 │
1432
+ * └───┘
1433
+ * >>> df.withColumns($df.col("a").isDuplicated().alias("dup"))
1434
+ * shape: (3, 2)
1435
+ * ┌───┬───────┐
1436
+ * │ a │ dup │
1437
+ * ├───┼───────┤
1438
+ * │ 1 │ false │
1439
+ * │ 2 │ false │
1440
+ * │ 3 │ false │
1441
+ * └───┴───────┘
1442
+ */
1443
+ isDuplicated(): this;
1444
+ /**
1445
+ * Checks if values are finite numbers (not NaN or Infinity).
1446
+ * @returns ColumnExpression
1447
+ * @example
1448
+ * >>> const df = $df.data({ a: [1, 2, 3] })
1449
+ * >>> df
1450
+ * shape: (3, 1)
1451
+ * ┌───┐
1452
+ * │ a │
1453
+ * ├───┤
1454
+ * │ 1 │
1455
+ * │ 2 │
1456
+ * │ 3 │
1457
+ * └───┘
1458
+ * >>> df.withColumns($df.col("a").isFinite().alias("finite"))
1459
+ * shape: (3, 2)
1460
+ * ┌───┬────────┐
1461
+ * │ a │ finite │
1462
+ * ├───┼────────┤
1463
+ * │ 1 │ true │
1464
+ * │ 2 │ true │
1465
+ * │ 3 │ true │
1466
+ * └───┴────────┘
1467
+ */
1468
+ isFinite(): this;
1469
+ /**
1470
+ * Checks if column values are members of a specified array or list.
1471
+ * @param values An array of candidate values or a single value to match against.
1472
+ * @returns ColumnExpression
1473
+ * @example
1474
+ * >>> const df = $df.data({ s: ["apple", "banana", "cherry"] })
1475
+ * >>> df
1476
+ * shape: (3, 1)
1477
+ * ┌──────────┐
1478
+ * │ s │
1479
+ * ├──────────┤
1480
+ * │ "apple" │
1481
+ * │ "banana" │
1482
+ * │ "cherry" │
1483
+ * └──────────┘
1484
+ * >>> df.withColumns($df.col("s").isIn(["apple", "banana"]).alias("in_list"))
1485
+ * shape: (3, 2)
1486
+ * ┌──────────┬─────────┐
1487
+ * │ s │ in_list │
1488
+ * ├──────────┼─────────┤
1489
+ * │ "apple" │ true │
1490
+ * │ "banana" │ true │
1491
+ * │ "cherry" │ false │
1492
+ * └──────────┴─────────┘
1493
+ */
1494
+ isIn(values: any[] | any): this;
1495
+ /**
1496
+ * Checks if values are positive or negative Infinity.
1497
+ * @returns ColumnExpression
1498
+ * @example
1499
+ * >>> const df = $df.data({ a: [1, 2, 3] })
1500
+ * >>> df
1501
+ * shape: (3, 1)
1502
+ * ┌───┐
1503
+ * │ a │
1504
+ * ├───┤
1505
+ * │ 1 │
1506
+ * │ 2 │
1507
+ * │ 3 │
1508
+ * └───┘
1509
+ * >>> df.withColumns($df.col("a").isInfinite().alias("inf"))
1510
+ * shape: (3, 2)
1511
+ * ┌───┬───────┐
1512
+ * │ a │ inf │
1513
+ * ├───┼───────┤
1514
+ * │ 1 │ false │
1515
+ * │ 2 │ false │
1516
+ * │ 3 │ false │
1517
+ * └───┴───────┘
1518
+ */
1519
+ isInfinite(): this;
1520
+ /**
1521
+ * Checks if values are NaN.
1522
+ * @returns ColumnExpression
1523
+ * @example
1524
+ * >>> const df = $df.data({ a: [1, 2, 3] })
1525
+ * >>> df
1526
+ * shape: (3, 1)
1527
+ * ┌───┐
1528
+ * │ a │
1529
+ * ├───┤
1530
+ * │ 1 │
1531
+ * │ 2 │
1532
+ * │ 3 │
1533
+ * └───┘
1534
+ * >>> df.withColumns($df.col("a").isNan().alias("nan"))
1535
+ * shape: (3, 2)
1536
+ * ┌───┬───────┐
1537
+ * │ a │ nan │
1538
+ * ├───┼───────┤
1539
+ * │ 1 │ false │
1540
+ * │ 2 │ false │
1541
+ * │ 3 │ false │
1542
+ * └───┴───────┘
1543
+ */
1544
+ isNan(): this;
1545
+ /**
1546
+ * Checks if column values match the N-th distinct value by positive or negative index position.
1547
+ * @param index The 0-based or negative index position into the ordered distinct values (e.g. 0 for first distinct, -1 for last distinct).
1548
+ * @param nullOnOob If true, returns null if index is out of bounds (default: true).
1549
+ * @returns ColumnExpression
1550
+ * @example
1551
+ * >>> const df = $df.data({ a: [1, 2, 3], b: [10, 20, 30] })
1552
+ * >>> df
1553
+ * shape: (3, 2)
1554
+ * ┌───┬────┐
1555
+ * │ a │ b │
1556
+ * ├───┼────┤
1557
+ * │ 1 │ 10 │
1558
+ * │ 2 │ 20 │
1559
+ * │ 3 │ 30 │
1560
+ * └───┴────┘
1561
+ * >>> df.withColumns($df.col("a").isNDistinct(0).alias("is_first"))
1562
+ * shape: (3, 3)
1563
+ * ┌───┬────┬──────────┐
1564
+ * │ a │ b │ is_first │
1565
+ * ├───┼────┼──────────┤
1566
+ * │ 1 │ 10 │ true │
1567
+ * │ 2 │ 20 │ false │
1568
+ * │ 3 │ 30 │ false │
1569
+ * └───┴────┴──────────┘
1570
+ */
1571
+ isNDistinct(index: number, nullOnOob?: boolean): this;
1572
+ /**
1573
+ * Checks if values are not NaN.
1574
+ * @returns ColumnExpression
1575
+ * @example
1576
+ * >>> const df = $df.data({ a: [1, 2, 3] })
1577
+ * >>> df
1578
+ * shape: (3, 1)
1579
+ * ┌───┐
1580
+ * │ a │
1581
+ * ├───┤
1582
+ * │ 1 │
1583
+ * │ 2 │
1584
+ * │ 3 │
1585
+ * └───┘
1586
+ * >>> df.withColumns($df.col("a").isNotNan().alias("not_nan"))
1587
+ * shape: (3, 2)
1588
+ * ┌───┬─────────┐
1589
+ * │ a │ not_nan │
1590
+ * ├───┼─────────┤
1591
+ * │ 1 │ true │
1592
+ * │ 2 │ true │
1593
+ * │ 3 │ true │
1594
+ * └───┴─────────┘
1595
+ */
1596
+ isNotNan(): this;
1597
+ /**
1598
+ * Checks if column values are non-null and valid (not null, undefined, or missing).
1599
+ * @returns ColumnExpression
1600
+ * @example
1601
+ * >>> const df = $df.data({ a: [1, null, 3], b: [null, 2, null] })
1602
+ * >>> df
1603
+ * shape: (3, 2)
1604
+ * ┌──────┬──────┐
1605
+ * │ a │ b │
1606
+ * ├──────┼──────┤
1607
+ * │ 1 │ null │
1608
+ * │ null │ 2 │
1609
+ * │ 3 │ null │
1610
+ * └──────┴──────┘
1611
+ * >>> df.withColumns($df.col("a").isNotNull().alias("valid"))
1612
+ * shape: (3, 2)
1613
+ * ┌──────┬───────┐
1614
+ * │ a │ valid │
1615
+ * ├──────┼───────┤
1616
+ * │ 1 │ true │
1617
+ * │ null │ false │
1618
+ * │ 3 │ true │
1619
+ * └──────┴───────┘
1620
+ */
1621
+ isNotNull(): this;
1622
+ /**
1623
+ * Checks if column values are null, undefined, or missing.
1624
+ * @returns ColumnExpression
1625
+ * @example
1626
+ * >>> const df = $df.data({ a: [1, null, 3], b: [null, 2, null] })
1627
+ * >>> df
1628
+ * shape: (3, 2)
1629
+ * ┌──────┬──────┐
1630
+ * │ a │ b │
1631
+ * ├──────┼──────┤
1632
+ * │ 1 │ null │
1633
+ * │ null │ 2 │
1634
+ * │ 3 │ null │
1635
+ * └──────┴──────┘
1636
+ * >>> df.withColumns($df.col("a").isNull().alias("missing"))
1637
+ * shape: (3, 2)
1638
+ * ┌──────┬─────────┐
1639
+ * │ a │ missing │
1640
+ * ├──────┼─────────┤
1641
+ * │ 1 │ false │
1642
+ * │ null │ true │
1643
+ * │ 3 │ false │
1644
+ * └──────┴─────────┘
1645
+ */
1646
+ isNull(): this;
1647
+ /**
1648
+ * Checks if values occur exactly once in the column.
1649
+ * @returns ColumnExpression
1650
+ * @example
1651
+ * >>> const df = $df.data({ a: [1, 2, 3] })
1652
+ * >>> df
1653
+ * shape: (3, 1)
1654
+ * ┌───┐
1655
+ * │ a │
1656
+ * ├───┤
1657
+ * │ 1 │
1658
+ * │ 2 │
1659
+ * │ 3 │
1660
+ * └───┘
1661
+ * >>> df.withColumns($df.col("a").isUnique().alias("uniq"))
1662
+ * shape: (3, 2)
1663
+ * ┌───┬──────┐
1664
+ * │ a │ uniq │
1665
+ * ├───┼──────┤
1666
+ * │ 1 │ true │
1667
+ * │ 2 │ true │
1668
+ * │ 3 │ true │
1669
+ * └───┴──────┘
1670
+ */
1671
+ isUnique(): this;
1672
+ /**
1673
+ * Aggregation: Computes the kurtosis (peakedness/tailedness) of a numeric column.
1674
+ * @param options Kurtosis calculation options ({ fisher?: boolean, bias?: boolean }, default fisher=true, bias=true).
1675
+ * @returns ColumnExpression
1676
+ * @example
1677
+ * >>> const df = $df.data({ a: [1, 2, 3] })
1678
+ * >>> df
1679
+ * shape: (3, 1)
1680
+ * ┌───┐
1681
+ * │ a │
1682
+ * ├───┤
1683
+ * │ 1 │
1684
+ * │ 2 │
1685
+ * │ 3 │
1686
+ * └───┘
1687
+ * >>> df.select($df.col("a").kurtosis().alias("kurt"))
1688
+ * shape: (1, 1)
1689
+ * ┌───────┐
1690
+ * │ kurt │
1691
+ * ├───────┤
1692
+ * │ -1.36 │
1693
+ * └───────┘
1694
+ */
1695
+ kurtosis(options?: KurtosisOptions): this;
1696
+ /**
1697
+ * Window: Shifts values down by offset, filling missing slots with default value.
1698
+ * @param offset Number of rows to shift down (default 1).
1699
+ * @param defaultVal Fallback fill value for empty slots (default null).
1700
+ * @returns ColumnExpression
1701
+ * @example
1702
+ * >>> const df = $df.data({ a: [1, 2, 3] })
1703
+ * >>> df
1704
+ * shape: (3, 1)
1705
+ * ┌───┐
1706
+ * │ a │
1707
+ * ├───┤
1708
+ * │ 1 │
1709
+ * │ 2 │
1710
+ * │ 3 │
1711
+ * └───┘
1712
+ * >>> df.withColumns($df.col("val").lag(1, 0).alias("prev"))
1713
+ * shape: (3, 2)
1714
+ * ┌─────┬──────┐
1715
+ * │ val │ prev │
1716
+ * ├─────┼──────┤
1717
+ * │ 10 │ 0 │
1718
+ * │ 20 │ 10 │
1719
+ * │ 30 │ 20 │
1720
+ * └─────┴──────┘
1721
+ */
1722
+ lag(offset?: number, defaultVal?: any): this;
1723
+ /**
1724
+ * Aggregation: Finds the last value in the group.
1725
+ * @returns ColumnExpression
1726
+ * @example
1727
+ * >>> const df = $df.data({ group: ["A", "A", "B"], val: [10, 20, 30] })
1728
+ * >>> df
1729
+ * shape: (3, 2)
1730
+ * ┌───────┬─────┐
1731
+ * │ group │ val │
1732
+ * ├───────┼─────┤
1733
+ * │ A │ 10 │
1734
+ * │ A │ 20 │
1735
+ * │ B │ 30 │
1736
+ * └───────┴─────┘
1737
+ * >>> df.groupBy("group").agg($df.col("val").last().alias("last_val"))
1738
+ * shape: (2, 2)
1739
+ * ┌───────┬──────────┐
1740
+ * │ group │ last_val │
1741
+ * ├───────┼──────────┤
1742
+ * │ A │ 20 │
1743
+ * │ B │ 30 │
1744
+ * └───────┴──────────┘
1745
+ */
1746
+ last(): this;
1747
+ /**
1748
+ * Boolean comparison: Returns true if less than or equal to argument.
1749
+ * @param val The value or column expression to compare against.
1750
+ * @returns ColumnExpression
1751
+ * @example
1752
+ * >>> const df = $df.data({ a: [1, 2, 3] })
1753
+ * >>> df
1754
+ * shape: (3, 1)
1755
+ * ┌───┐
1756
+ * │ a │
1757
+ * ├───┤
1758
+ * │ 1 │
1759
+ * │ 2 │
1760
+ * │ 3 │
1761
+ * └───┘
1762
+ * >>> df.withColumns($df.col("a").le(2).alias("le_two"))
1763
+ * shape: (3, 2)
1764
+ * ┌───┬────────┐
1765
+ * │ a │ le_two │
1766
+ * ├───┼────────┤
1767
+ * │ 1 │ true │
1768
+ * │ 2 │ true │
1769
+ * │ 3 │ false │
1770
+ * └───┴────────┘
1771
+ */
1772
+ le(val: any): this;
1773
+ /**
1774
+ * Window: Shifts values up by offset, filling missing slots with default value.
1775
+ * @param offset Number of rows to shift up (default 1).
1776
+ * @param defaultVal Fallback fill value for empty slots (default null).
1777
+ * @returns ColumnExpression
1778
+ * @example
1779
+ * >>> const df = $df.data({ a: [1, 2, 3] })
1780
+ * >>> df
1781
+ * shape: (3, 1)
1782
+ * ┌───┐
1783
+ * │ a │
1784
+ * ├───┤
1785
+ * │ 1 │
1786
+ * │ 2 │
1787
+ * │ 3 │
1788
+ * └───┘
1789
+ * >>> df.withColumns($df.col("val").lead(1, 0).alias("next"))
1790
+ * shape: (3, 2)
1791
+ * ┌─────┬──────┐
1792
+ * │ val │ next │
1793
+ * ├─────┼──────┤
1794
+ * │ 10 │ 20 │
1795
+ * │ 20 │ 30 │
1796
+ * │ 30 │ 0 │
1797
+ * └─────┴──────┘
1798
+ */
1799
+ lead(offset?: number, defaultVal?: any): this;
1800
+ /**
1801
+ * Computes the logarithm of positive values with a specified base.
1802
+ * @param base The base of the logarithm (default: Math.E).
1803
+ * @returns ColumnExpression
1804
+ * @example
1805
+ * >>> const df = $df.data({ a: [1, 2, 3] })
1806
+ * >>> df
1807
+ * shape: (3, 1)
1808
+ * ┌───┐
1809
+ * │ a │
1810
+ * ├───┤
1811
+ * │ 1 │
1812
+ * │ 2 │
1813
+ * │ 3 │
1814
+ * └───┘
1815
+ * >>> df.withColumns($df.col("a").log(10).alias("log_a"))
1816
+ * shape: (3, 2)
1817
+ * ┌───┬──────────┐
1818
+ * │ a │ log_a │
1819
+ * ├───┼──────────┤
1820
+ * │ 1 │ 0 │
1821
+ * │ 2 │ 0.30103 │
1822
+ * │ 3 │ 0.477121 │
1823
+ * └───┴──────────┘
1824
+ */
1825
+ log(base?: number): this;
1826
+ /**
1827
+ * Computes natural logarithm of 1 + x.
1828
+ * @returns ColumnExpression
1829
+ * @example
1830
+ * >>> const df = $df.data({ a: [1, 2, 3] })
1831
+ * >>> df
1832
+ * shape: (3, 1)
1833
+ * ┌───┐
1834
+ * │ a │
1835
+ * ├───┤
1836
+ * │ 1 │
1837
+ * │ 2 │
1838
+ * │ 3 │
1839
+ * └───┘
1840
+ * >>> df.withColumns($df.col("a").log1p().alias("log1p_a"))
1841
+ * shape: (3, 2)
1842
+ * ┌───┬──────────┐
1843
+ * │ a │ log1p_a │
1844
+ * ├───┼──────────┤
1845
+ * │ 1 │ 0.693147 │
1846
+ * │ 2 │ 1.098612 │
1847
+ * │ 3 │ 1.386294 │
1848
+ * └───┴──────────┘
1849
+ */
1850
+ log1p(): this;
1851
+ /**
1852
+ * Boolean comparison: Returns true if less than argument.
1853
+ * @param val The value or column expression to compare against.
1854
+ * @returns ColumnExpression
1855
+ * @example
1856
+ * >>> const df = $df.data({ a: [1, 2, 3] })
1857
+ * >>> df
1858
+ * shape: (3, 1)
1859
+ * ┌───┐
1860
+ * │ a │
1861
+ * ├───┤
1862
+ * │ 1 │
1863
+ * │ 2 │
1864
+ * │ 3 │
1865
+ * └───┘
1866
+ * >>> df.withColumns($df.col("a").lt(2).alias("lt_two"))
1867
+ * shape: (3, 2)
1868
+ * ┌───┬────────┐
1869
+ * │ a │ lt_two │
1870
+ * ├───┼────────┤
1871
+ * │ 1 │ true │
1872
+ * │ 2 │ false │
1873
+ * │ 3 │ false │
1874
+ * └───┴────────┘
1875
+ */
1876
+ lt(val: any): this;
1877
+ /**
1878
+ * Aggregation: Finds the maximum value in the group.
1879
+ * @returns ColumnExpression
1880
+ * @example
1881
+ * >>> const df = $df.data({ group: ["A", "A", "B"], val: [10, 20, 30] })
1882
+ * >>> df
1883
+ * shape: (3, 2)
1884
+ * ┌───────┬─────┐
1885
+ * │ group │ val │
1886
+ * ├───────┼─────┤
1887
+ * │ A │ 10 │
1888
+ * │ A │ 20 │
1889
+ * │ B │ 30 │
1890
+ * └───────┴─────┘
1891
+ * >>> df.groupBy("group").agg($df.col("val").max().alias("max_val"))
1892
+ * shape: (2, 2)
1893
+ * ┌───────┬─────────┐
1894
+ * │ group │ max_val │
1895
+ * ├───────┼─────────┤
1896
+ * │ A │ 20 │
1897
+ * │ B │ 30 │
1898
+ * └───────┴─────────┘
1899
+ */
1900
+ max(): this;
1901
+ /**
1902
+ * Aggregation: Finds the value in this column corresponding to the maximum value in the `by` expression.
1903
+ * @param by Column or expression to order by.
1904
+ * @returns ColumnExpression
1905
+ * @example
1906
+ * >>> const df = $df.data({ group: ["A", "A", "B"], val: [10, 20, 30] })
1907
+ * >>> df
1908
+ * shape: (3, 2)
1909
+ * ┌───────┬─────┐
1910
+ * │ group │ val │
1911
+ * ├───────┼─────┤
1912
+ * │ A │ 10 │
1913
+ * │ A │ 20 │
1914
+ * │ B │ 30 │
1915
+ * └───────┴─────┘
1916
+ * >>> df.select($df.col("group").maxBy($df.col("val")).alias("top_group"))
1917
+ * shape: (1, 1)
1918
+ * ┌───────────┐
1919
+ * │ top_group │
1920
+ * ├───────────┤
1921
+ * │ B │
1922
+ * └───────────┘
1923
+ */
1924
+ maxBy(by: any): this;
1925
+ /**
1926
+ * Aggregation: Computes the arithmetic mean of elements in the group.
1927
+ * @returns ColumnExpression
1928
+ * @example
1929
+ * >>> const df = $df.data({ group: ["A", "A", "B"], val: [10, 20, 30] })
1930
+ * >>> df
1931
+ * shape: (3, 2)
1932
+ * ┌───────┬─────┐
1933
+ * │ group │ val │
1934
+ * ├───────┼─────┤
1935
+ * │ A │ 10 │
1936
+ * │ A │ 20 │
1937
+ * │ B │ 30 │
1938
+ * └───────┴─────┘
1939
+ * >>> df.groupBy("group").agg($df.col("val").mean().alias("mean_val"))
1940
+ * shape: (2, 2)
1941
+ * ┌───────┬──────────┐
1942
+ * │ group │ mean_val │
1943
+ * ├───────┼──────────┤
1944
+ * │ A │ 15 │
1945
+ * │ B │ 30 │
1946
+ * └───────┴──────────┘
1947
+ */
1948
+ mean(): this;
1949
+ /**
1950
+ * Aggregation: Computes the 50th percentile median.
1951
+ * @returns ColumnExpression
1952
+ * @example
1953
+ * >>> const df = $df.data({ group: ["A", "A", "B"], val: [10, 20, 30] })
1954
+ * >>> df
1955
+ * shape: (3, 2)
1956
+ * ┌───────┬─────┐
1957
+ * │ group │ val │
1958
+ * ├───────┼─────┤
1959
+ * │ A │ 10 │
1960
+ * │ A │ 20 │
1961
+ * │ B │ 30 │
1962
+ * └───────┴─────┘
1963
+ * >>> df.groupBy("group").agg($df.col("val").median().alias("med"))
1964
+ * shape: (2, 2)
1965
+ * ┌───────┬─────┐
1966
+ * │ group │ med │
1967
+ * ├───────┼─────┤
1968
+ * │ A │ 15 │
1969
+ * │ B │ 30 │
1970
+ * └───────┴─────┘
1971
+ */
1972
+ median(): this;
1973
+ /**
1974
+ * Aggregation: Finds the minimum value in the group.
1975
+ * @returns ColumnExpression
1976
+ * @example
1977
+ * >>> const df = $df.data({ group: ["A", "A", "B"], val: [10, 20, 30] })
1978
+ * >>> df
1979
+ * shape: (3, 2)
1980
+ * ┌───────┬─────┐
1981
+ * │ group │ val │
1982
+ * ├───────┼─────┤
1983
+ * │ A │ 10 │
1984
+ * │ A │ 20 │
1985
+ * │ B │ 30 │
1986
+ * └───────┴─────┘
1987
+ * >>> df.groupBy("group").agg($df.col("val").min().alias("min_val"))
1988
+ * shape: (2, 2)
1989
+ * ┌───────┬─────────┐
1990
+ * │ group │ min_val │
1991
+ * ├───────┼─────────┤
1992
+ * │ A │ 10 │
1993
+ * │ B │ 30 │
1994
+ * └───────┴─────────┘
1995
+ */
1996
+ min(): this;
1997
+ /**
1998
+ * Aggregation: Finds the value in this column corresponding to the minimum value in the `by` expression.
1999
+ * @param by Column or expression to order by.
2000
+ * @returns ColumnExpression
2001
+ * @example
2002
+ * >>> const df = $df.data({ group: ["A", "A", "B"], val: [10, 20, 30] })
2003
+ * >>> df
2004
+ * shape: (3, 2)
2005
+ * ┌───────┬─────┐
2006
+ * │ group │ val │
2007
+ * ├───────┼─────┤
2008
+ * │ A │ 10 │
2009
+ * │ A │ 20 │
2010
+ * │ B │ 30 │
2011
+ * └───────┴─────┘
2012
+ * >>> df.select($df.col("group").minBy($df.col("val")).alias("lowest_group"))
2013
+ * shape: (1, 1)
2014
+ * ┌──────────────┐
2015
+ * │ lowest_group │
2016
+ * ├──────────────┤
2017
+ * │ A │
2018
+ * └──────────────┘
2019
+ */
2020
+ minBy(by: any): this;
2021
+ /**
2022
+ * Computes modulo remainder (x % y) of column values.
2023
+ * @param val The divisor value or column expression.
2024
+ * @returns ColumnExpression
2025
+ * @example
2026
+ * >>> const df = $df.data({ a: [1, 2, 3] })
2027
+ * >>> df
2028
+ * shape: (3, 1)
2029
+ * ┌───┐
2030
+ * │ a │
2031
+ * ├───┤
2032
+ * │ 1 │
2033
+ * │ 2 │
2034
+ * │ 3 │
2035
+ * └───┘
2036
+ * >>> df.withColumns($df.col("a").mod(2).alias("mod_a"))
2037
+ * shape: (3, 2)
2038
+ * ┌───┬───────┐
2039
+ * │ a │ mod_a │
2040
+ * ├───┼───────┤
2041
+ * │ 1 │ 1 │
2042
+ * │ 2 │ 0 │
2043
+ * │ 3 │ 1 │
2044
+ * └───┴───────┘
2045
+ */
2046
+ mod(val: NumericArg): this;
2047
+ /**
2048
+ * Aggregation: Finds the statistical mode (most frequent value).
2049
+ * @returns ColumnExpression
2050
+ * @example
2051
+ * >>> const df = $df.data({ group: ["A", "A", "B"], val: [10, 20, 30] })
2052
+ * >>> df
2053
+ * shape: (3, 2)
2054
+ * ┌───────┬─────┐
2055
+ * │ group │ val │
2056
+ * ├───────┼─────┤
2057
+ * │ A │ 10 │
2058
+ * │ A │ 20 │
2059
+ * │ B │ 30 │
2060
+ * └───────┴─────┘
2061
+ * >>> df.select($df.col("group").mode().alias("mode_group"))
2062
+ * shape: (1, 1)
2063
+ * ┌────────────┐
2064
+ * │ mode_group │
2065
+ * ├────────────┤
2066
+ * │ ["A"] │
2067
+ * └────────────┘
2068
+ */
2069
+ mode(): this;
2070
+ /**
2071
+ * Multiplies column values by a scalar or another column expression.
2072
+ * @param val The multiplier value or column expression.
2073
+ * @returns ColumnExpression
2074
+ * @example
2075
+ * >>> const df = $df.data({ a: [1, 2, 3] })
2076
+ * >>> df
2077
+ * shape: (3, 1)
2078
+ * ┌───┐
2079
+ * │ a │
2080
+ * ├───┤
2081
+ * │ 1 │
2082
+ * │ 2 │
2083
+ * │ 3 │
2084
+ * └───┘
2085
+ * >>> df.withColumns($df.col("a").mul(5).alias("multiplied"))
2086
+ * shape: (3, 2)
2087
+ * ┌───┬────────────┐
2088
+ * │ a │ multiplied │
2089
+ * ├───┼────────────┤
2090
+ * │ 1 │ 5 │
2091
+ * │ 2 │ 10 │
2092
+ * │ 3 │ 15 │
2093
+ * └───┴────────────┘
2094
+ */
2095
+ mul(val: NumericArg): this;
2096
+ /**
2097
+ * Aggregation: Finds the maximum value in the group, taking NaN values into account (NaN propagates).
2098
+ * @returns ColumnExpression
2099
+ * @example
2100
+ * >>> const df = $df.data({ a: [1, 2, 3] })
2101
+ * >>> df
2102
+ * shape: (3, 1)
2103
+ * ┌───┐
2104
+ * │ a │
2105
+ * ├───┤
2106
+ * │ 1 │
2107
+ * │ 2 │
2108
+ * │ 3 │
2109
+ * └───┘
2110
+ * >>> df.select($df.col("val").nanMax().alias("nan_max_val"))
2111
+ * shape: (1, 1)
2112
+ * ┌─────────────┐
2113
+ * │ nan_max_val │
2114
+ * ├─────────────┤
2115
+ * │ 30 │
2116
+ * └─────────────┘
2117
+ */
2118
+ nanMax(): this;
2119
+ /**
2120
+ * Aggregation: Finds the minimum value in the group, taking NaN values into account (NaN propagates).
2121
+ * @returns ColumnExpression
2122
+ * @example
2123
+ * >>> const df = $df.data({ a: [1, 2, 3] })
2124
+ * >>> df
2125
+ * shape: (3, 1)
2126
+ * ┌───┐
2127
+ * │ a │
2128
+ * ├───┤
2129
+ * │ 1 │
2130
+ * │ 2 │
2131
+ * │ 3 │
2132
+ * └───┘
2133
+ * >>> df.select($df.col("val").nanMin().alias("nan_min_val"))
2134
+ * shape: (1, 1)
2135
+ * ┌─────────────┐
2136
+ * │ nan_min_val │
2137
+ * ├─────────────┤
2138
+ * │ 10 │
2139
+ * └─────────────┘
2140
+ */
2141
+ nanMin(): this;
2142
+ /**
2143
+ * Boolean comparison: Returns true if values do not match.
2144
+ * @param val The value or column expression to compare against.
2145
+ * @returns ColumnExpression
2146
+ * @example
2147
+ * >>> const df = $df.data({ a: [1, 2, 3] })
2148
+ * >>> df
2149
+ * shape: (3, 1)
2150
+ * ┌───┐
2151
+ * │ a │
2152
+ * ├───┤
2153
+ * │ 1 │
2154
+ * │ 2 │
2155
+ * │ 3 │
2156
+ * └───┘
2157
+ * >>> df.withColumns($df.col("a").ne(2).alias("not_two"))
2158
+ * shape: (3, 2)
2159
+ * ┌───┬─────────┐
2160
+ * │ a │ not_two │
2161
+ * ├───┼─────────┤
2162
+ * │ 1 │ true │
2163
+ * │ 2 │ false │
2164
+ * │ 3 │ true │
2165
+ * └───┴─────────┘
2166
+ */
2167
+ ne(val: any): this;
2168
+ /**
2169
+ * Negates column values (-x).
2170
+ * @returns ColumnExpression
2171
+ * @example
2172
+ * >>> const df = $df.data({ a: [1, 2, 3] })
2173
+ * >>> df
2174
+ * shape: (3, 1)
2175
+ * ┌───┐
2176
+ * │ a │
2177
+ * ├───┤
2178
+ * │ 1 │
2179
+ * │ 2 │
2180
+ * │ 3 │
2181
+ * └───┘
2182
+ * >>> df.withColumns($df.col("a").negate().alias("negated"))
2183
+ * shape: (3, 2)
2184
+ * ┌───┬─────────┐
2185
+ * │ a │ negated │
2186
+ * ├───┼─────────┤
2187
+ * │ 1 │ -1 │
2188
+ * │ 2 │ -2 │
2189
+ * │ 3 │ -3 │
2190
+ * └───┴─────────┘
2191
+ */
2192
+ negate(): this;
2193
+ /**
2194
+ * Difference check that treats null values as equal to each other.
2195
+ * @param val The value or column expression to compare against.
2196
+ * @returns ColumnExpression
2197
+ * @example
2198
+ * >>> const df = $df.data({ a: [1, null, 3], b: [null, 2, null] })
2199
+ * >>> df
2200
+ * shape: (3, 2)
2201
+ * ┌──────┬──────┐
2202
+ * │ a │ b │
2203
+ * ├──────┼──────┤
2204
+ * │ 1 │ null │
2205
+ * │ null │ 2 │
2206
+ * │ 3 │ null │
2207
+ * └──────┴──────┘
2208
+ * >>> df.withColumns($df.col("a").neMissing(null).alias("not_missing"))
2209
+ * shape: (3, 2)
2210
+ * ┌──────┬─────────────┐
2211
+ * │ a │ not_missing │
2212
+ * ├──────┼─────────────┤
2213
+ * │ 1 │ true │
2214
+ * │ null │ false │
2215
+ * │ 3 │ true │
2216
+ * └──────┴─────────────┘
2217
+ */
2218
+ neMissing(val: any): this;
2219
+ /**
2220
+ * Logical negation.
2221
+ * @returns ColumnExpression
2222
+ * @example
2223
+ * >>> const df = $df.data({ a: [true, true, false, false], b: [true, false, true, false] })
2224
+ * >>> df
2225
+ * shape: (4, 2)
2226
+ * ┌───────┬───────┐
2227
+ * │ a │ b │
2228
+ * ├───────┼───────┤
2229
+ * │ true │ true │
2230
+ * │ true │ false │
2231
+ * │ false │ true │
2232
+ * │ false │ false │
2233
+ * └───────┴───────┘
2234
+ * >>> df.withColumns($df.col("a").not().alias("not_a"))
2235
+ * shape: (4, 3)
2236
+ * ┌───────┬───────┬───────┐
2237
+ * │ a │ b │ not_a │
2238
+ * ├───────┼───────┼───────┤
2239
+ * │ true │ true │ false │
2240
+ * │ true │ false │ false │
2241
+ * │ false │ false │ true │
2242
+ * │ null │ true │ null │
2243
+ * └───────┴───────┴───────┘
2244
+ */
2245
+ not(): this;
2246
+ /**
2247
+ * Checks if values are not elements of a specific array or set list.
2248
+ * @param values An array of candidate values or a single value to match against.
2249
+ * @returns ColumnExpression
2250
+ * @example
2251
+ * >>> const df = $df.data({ s: ["apple", "banana", "cherry"] })
2252
+ * >>> df
2253
+ * shape: (3, 1)
2254
+ * ┌──────────┐
2255
+ * │ s │
2256
+ * ├──────────┤
2257
+ * │ "apple" │
2258
+ * │ "banana" │
2259
+ * │ "cherry" │
2260
+ * └──────────┘
2261
+ * >>> df.withColumns($df.col("s").notIn(["apple", "banana"]).alias("not_in"))
2262
+ * shape: (3, 2)
2263
+ * ┌──────────┬────────┐
2264
+ * │ s │ not_in │
2265
+ * ├──────────┼────────┤
2266
+ * │ "apple" │ false │
2267
+ * │ "banana" │ false │
2268
+ * │ "cherry" │ true │
2269
+ * └──────────┴────────┘
2270
+ */
2271
+ notIn(values: any[] | any): this;
2272
+ /**
2273
+ * Aggregation: Counts the number of null or missing records.
2274
+ * @returns ColumnExpression
2275
+ * @example
2276
+ * >>> const df = $df.data({ a: [1, null, 3], b: [null, 2, null] })
2277
+ * >>> df
2278
+ * shape: (3, 2)
2279
+ * ┌──────┬──────┐
2280
+ * │ a │ b │
2281
+ * ├──────┼──────┤
2282
+ * │ 1 │ null │
2283
+ * │ null │ 2 │
2284
+ * │ 3 │ null │
2285
+ * └──────┴──────┘
2286
+ * >>> df.select($df.col("a").nullCount().alias("nulls"))
2287
+ * shape: (1, 1)
2288
+ * ┌───────┐
2289
+ * │ nulls │
2290
+ * ├───────┤
2291
+ * │ 1 │
2292
+ * └───────┘
2293
+ */
2294
+ nullCount(): this;
2295
+ /**
2296
+ * Aggregation: Computes number of unique elements.
2297
+ * @param options Uniqueness options.
2298
+ * @returns ColumnExpression
2299
+ * @example
2300
+ * >>> const df = $df.data({ group: ["A", "A", "B"], val: [10, 20, 30] })
2301
+ * >>> df
2302
+ * shape: (3, 2)
2303
+ * ┌───────┬─────┐
2304
+ * │ group │ val │
2305
+ * ├───────┼─────┤
2306
+ * │ A │ 10 │
2307
+ * │ A │ 20 │
2308
+ * │ B │ 30 │
2309
+ * └───────┴─────┘
2310
+ * >>> df.select($df.col("group").nUnique().alias("unique_cnt"))
2311
+ * shape: (1, 1)
2312
+ * ┌────────────┐
2313
+ * │ unique_cnt │
2314
+ * ├────────────┤
2315
+ * │ 2 │
2316
+ * └────────────┘
2317
+ */
2318
+ nUnique(options?: UniqueArrayStatsOptions): this;
2319
+ /**
2320
+ * Logical OR check supporting Kleene logic.
2321
+ * @param other The other boolean column expression or literal value to compare.
2322
+ * @returns ColumnExpression
2323
+ * @example
2324
+ * >>> const df = $df.data({ a: [true, true, false, false], b: [true, false, true, false] })
2325
+ * >>> df
2326
+ * shape: (4, 2)
2327
+ * ┌───────┬───────┐
2328
+ * │ a │ b │
2329
+ * ├───────┼───────┤
2330
+ * │ true │ true │
2331
+ * │ true │ false │
2332
+ * │ false │ true │
2333
+ * │ false │ false │
2334
+ * └───────┴───────┘
2335
+ * >>> df.withColumns($df.col("a").or($df.col("b")).alias("or_res"))
2336
+ * shape: (4, 3)
2337
+ * ┌───────┬───────┬────────┐
2338
+ * │ a │ b │ or_res │
2339
+ * ├───────┼───────┼────────┤
2340
+ * │ true │ true │ true │
2341
+ * │ true │ false │ true │
2342
+ * │ false │ false │ false │
2343
+ * │ null │ true │ true │
2344
+ * └───────┴───────┴────────┘
2345
+ */
2346
+ or(other: any): this;
2347
+ /**
2348
+ * Executes a window aggregation partitioned by column keys.
2349
+ * @param columns Column expression or array of columns to partition by.
2350
+ * @returns ColumnExpression
2351
+ * @example
2352
+ * >>> const df = $df.data({ group: ["A", "A", "B"], val: [10, 20, 30] })
2353
+ * >>> df
2354
+ * shape: (3, 2)
2355
+ * ┌───────┬─────┐
2356
+ * │ group │ val │
2357
+ * ├───────┼─────┤
2358
+ * │ A │ 10 │
2359
+ * │ A │ 20 │
2360
+ * │ B │ 30 │
2361
+ * └───────┴─────┘
2362
+ * >>> df.withColumns($df.col("val").sum().over("group").alias("cat_sum"))
2363
+ * shape: (3, 3)
2364
+ * ┌───────┬─────┬─────────┐
2365
+ * │ group │ val │ cat_sum │
2366
+ * ├───────┼─────┼─────────┤
2367
+ * │ A │ 10 │ 30 │
2368
+ * │ A │ 20 │ 30 │
2369
+ * │ B │ 30 │ 30 │
2370
+ * └───────┴─────┴─────────┘
2371
+ */
2372
+ over(columns: string | IExpr | (string | IExpr)[]): this;
2373
+ /**
2374
+ * Raises column values to the specified power.
2375
+ * @param val The exponent power value or column expression.
2376
+ * @returns ColumnExpression
2377
+ * @example
2378
+ * >>> const df = $df.data({ a: [1, 2, 3] })
2379
+ * >>> df
2380
+ * shape: (3, 1)
2381
+ * ┌───┐
2382
+ * │ a │
2383
+ * ├───┤
2384
+ * │ 1 │
2385
+ * │ 2 │
2386
+ * │ 3 │
2387
+ * └───┘
2388
+ * >>> df.withColumns($df.col("a").pow(2).alias("pow_a"))
2389
+ * shape: (3, 2)
2390
+ * ┌───┬───────┐
2391
+ * │ a │ pow_a │
2392
+ * ├───┼───────┤
2393
+ * │ 1 │ 1 │
2394
+ * │ 2 │ 4 │
2395
+ * │ 3 │ 9 │
2396
+ * └───┴───────┘
2397
+ */
2398
+ pow(val: NumericArg): this;
2399
+ /**
2400
+ * Aggregation: Computes the product of all elements in the group.
2401
+ * @returns ColumnExpression
2402
+ * @example
2403
+ * >>> const df = $df.data({ group: ["A", "A", "B"], val: [10, 20, 30] })
2404
+ * >>> df
2405
+ * shape: (3, 2)
2406
+ * ┌───────┬─────┐
2407
+ * │ group │ val │
2408
+ * ├───────┼─────┤
2409
+ * │ A │ 10 │
2410
+ * │ A │ 20 │
2411
+ * │ B │ 30 │
2412
+ * └───────┴─────┘
2413
+ * >>> df.groupBy("group").agg($df.col("val").product().alias("p"))
2414
+ * shape: (2, 2)
2415
+ * ┌───────┬─────┐
2416
+ * │ group │ p │
2417
+ * ├───────┼─────┤
2418
+ * │ A │ 200 │
2419
+ * │ B │ 30 │
2420
+ * └───────┴─────┘
2421
+ */
2422
+ product(): this;
2423
+ /**
2424
+ * Aggregation: Computes the specific quantile values (0.0 to 1.0).
2425
+ * @param q The quantile parameter value between 0.0 and 1.0.
2426
+ * @returns ColumnExpression
2427
+ * @example
2428
+ * >>> const df = $df.data({ a: [1, 2, 3] })
2429
+ * >>> df
2430
+ * shape: (3, 1)
2431
+ * ┌───┐
2432
+ * │ a │
2433
+ * ├───┤
2434
+ * │ 1 │
2435
+ * │ 2 │
2436
+ * │ 3 │
2437
+ * └───┘
2438
+ * >>> df.select($df.col("a").quantile(0.75).alias("q75"))
2439
+ * shape: (1, 1)
2440
+ * ┌──────┐
2441
+ * │ q75 │
2442
+ * ├──────┤
2443
+ * │ 3.25 │
2444
+ * └──────┘
2445
+ */
2446
+ quantile(q: number): this;
2447
+ /**
2448
+ * Converts angles from degrees to radians.
2449
+ * @returns ColumnExpression
2450
+ * @example
2451
+ * >>> const df = $df.data({ a: [1, 2, 3] })
2452
+ * >>> df
2453
+ * shape: (3, 1)
2454
+ * ┌───┐
2455
+ * │ a │
2456
+ * ├───┤
2457
+ * │ 1 │
2458
+ * │ 2 │
2459
+ * │ 3 │
2460
+ * └───┘
2461
+ * >>> df.withColumns($df.col("a").radians().alias("rad"))
2462
+ * shape: (3, 2)
2463
+ * ┌───┬──────────┐
2464
+ * │ a │ rad │
2465
+ * ├───┼──────────┤
2466
+ * │ 1 │ 0.017453 │
2467
+ * │ 2 │ 0.034907 │
2468
+ * │ 3 │ 0.05236 │
2469
+ * └───┴──────────┘
2470
+ */
2471
+ radians(): this;
2472
+ /**
2473
+ * Fills sequence with pseudo-random generated floats or integers.
2474
+ * @param seed Optional seed to initialize the pseudo-random generator.
2475
+ * @param options Config options including min, max, and integer flag.
2476
+ * @returns ColumnExpression
2477
+ * @example
2478
+ * >>> const df = $df.data({ a: [1, 2, 3] })
2479
+ * >>> df
2480
+ * shape: (3, 1)
2481
+ * ┌───┐
2482
+ * │ a │
2483
+ * ├───┤
2484
+ * │ 1 │
2485
+ * │ 2 │
2486
+ * │ 3 │
2487
+ * └───┘
2488
+ * >>> df.withColumns($df.col("a").rand(42, { min: 1, max: 10, integer: true }).alias("random"))
2489
+ * shape: (3, 2)
2490
+ * ┌───┬────────┐
2491
+ * │ a │ random │
2492
+ * ├───┼────────┤
2493
+ * │ 1 │ 7 │
2494
+ * │ 2 │ 8 │
2495
+ * │ 3 │ 6 │
2496
+ * └───┴────────┘
2497
+ */
2498
+ rand(seed?: number, { min, max, integer }?: RandomOptions): this;
2499
+ /**
2500
+ * Window: Computes rank within group partition.
2501
+ * @returns ColumnExpression
2502
+ * @example
2503
+ * >>> const df = $df.data({ a: [1, 2, 3] })
2504
+ * >>> df
2505
+ * shape: (3, 1)
2506
+ * ┌───┐
2507
+ * │ a │
2508
+ * ├───┤
2509
+ * │ 1 │
2510
+ * │ 2 │
2511
+ * │ 3 │
2512
+ * └───┘
2513
+ * >>> df.withColumns($df.col("score").rank().alias("rank"))
2514
+ * shape: (2, 2)
2515
+ * ┌───────┬──────┐
2516
+ * │ score │ rank │
2517
+ * ├───────┼──────┤
2518
+ * │ 75 │ 1 │
2519
+ * │ 95 │ 2 │
2520
+ * └───────┴──────┘
2521
+ */
2522
+ rank(options?: {
2523
+ dense?: boolean;
2524
+ }): this;
2525
+ /**
2526
+ * Reverses the order of values in the column.
2527
+ * @returns ColumnExpression
2528
+ * @example
2529
+ * >>> const df = $df.data({ a: [1, 2, 3] })
2530
+ * >>> df
2531
+ * shape: (3, 1)
2532
+ * ┌───┐
2533
+ * │ a │
2534
+ * ├───┤
2535
+ * │ 1 │
2536
+ * │ 2 │
2537
+ * │ 3 │
2538
+ * └───┘
2539
+ * >>> df.withColumns($df.col("a").reverse().alias("reversed"))
2540
+ * shape: (3, 2)
2541
+ * ┌───┬──────────┐
2542
+ * │ a │ reversed │
2543
+ * ├───┼──────────┤
2544
+ * │ 1 │ 3 │
2545
+ * │ 2 │ 2 │
2546
+ * │ 3 │ 1 │
2547
+ * └───┴──────────┘
2548
+ */
2549
+ reverse(): this;
2550
+ /**
2551
+ * Window: Computes a rolling window reduction using a ColumnExpression or a custom callback function.
2552
+ * @param optionsOrWindowSize Window row count or RollingOptions configuration.
2553
+ * @param exprOrFn ColumnExpression to evaluate over each window slice, or a custom reducer function.
2554
+ * @returns ColumnExpression
2555
+ * @example
2556
+ * >>> const df = $df.data({ a: [1, 2, 3] })
2557
+ * >>> df
2558
+ * shape: (3, 1)
2559
+ * ┌───┐
2560
+ * │ a │
2561
+ * ├───┤
2562
+ * │ 1 │
2563
+ * │ 2 │
2564
+ * │ 3 │
2565
+ * └───┘
2566
+ * >>> df.withColumns($df.col("val").rolling(2, $df.col("val").sum()).alias("r_sum"))
2567
+ * shape: (3, 2)
2568
+ * ┌─────┬───────┐
2569
+ * │ val │ r_sum │
2570
+ * ├─────┼───────┤
2571
+ * │ 10 │ 10 │
2572
+ * │ 20 │ 30 │
2573
+ * │ 30 │ 50 │
2574
+ * └─────┴───────┘
2575
+ */
2576
+ rolling(optionsOrWindowSize: number | RollingOptions, exprOrFn: IExpr | ((vals: any[]) => any)): this;
2577
+ /**
2578
+ * Window: Computes rolling window maximum value.
2579
+ * @param windowSize Size of rolling window.
2580
+ * @returns ColumnExpression
2581
+ * @example
2582
+ * >>> const df = $df.data({ a: [1, 2, 3] })
2583
+ * >>> df
2584
+ * shape: (3, 1)
2585
+ * ┌───┐
2586
+ * │ a │
2587
+ * ├───┤
2588
+ * │ 1 │
2589
+ * │ 2 │
2590
+ * │ 3 │
2591
+ * └───┘
2592
+ * >>> df.withColumns($df.col("val").rollingMax(2).alias("r_max"))
2593
+ * shape: (3, 2)
2594
+ * ┌─────┬───────┐
2595
+ * │ val │ r_max │
2596
+ * ├─────┼───────┤
2597
+ * │ 10 │ 10 │
2598
+ * │ 20 │ 20 │
2599
+ * │ 30 │ 30 │
2600
+ * └─────┴───────┘
2601
+ */
2602
+ rollingMax(windowSize: number): this;
2603
+ /**
2604
+ * Window: Computes rolling window mean average.
2605
+ * @param windowSize Size of rolling window.
2606
+ * @returns ColumnExpression
2607
+ * @example
2608
+ * >>> const df = $df.data({ a: [1, 2, 3] })
2609
+ * >>> df
2610
+ * shape: (3, 1)
2611
+ * ┌───┐
2612
+ * │ a │
2613
+ * ├───┤
2614
+ * │ 1 │
2615
+ * │ 2 │
2616
+ * │ 3 │
2617
+ * └───┘
2618
+ * >>> df.withColumns($df.col("val").rollingMean(2).alias("r_mean"))
2619
+ * shape: (3, 2)
2620
+ * ┌─────┬────────┐
2621
+ * │ val │ r_mean │
2622
+ * ├─────┼────────┤
2623
+ * │ 10 │ 10 │
2624
+ * │ 20 │ 15 │
2625
+ * │ 30 │ 25 │
2626
+ * └─────┴────────┘
2627
+ */
2628
+ rollingMean(windowSize: number): this;
2629
+ /**
2630
+ * Window: Computes rolling window median value.
2631
+ * @param windowSize Size of rolling window.
2632
+ * @returns ColumnExpression
2633
+ * @example
2634
+ * >>> const df = $df.data({ a: [1, 2, 3] })
2635
+ * >>> df
2636
+ * shape: (3, 1)
2637
+ * ┌───┐
2638
+ * │ a │
2639
+ * ├───┤
2640
+ * │ 1 │
2641
+ * │ 2 │
2642
+ * │ 3 │
2643
+ * └───┘
2644
+ * >>> df.withColumns($df.col("val").rollingMedian(2).alias("r_med"))
2645
+ * shape: (3, 2)
2646
+ * ┌─────┬───────┐
2647
+ * │ val │ r_med │
2648
+ * ├─────┼───────┤
2649
+ * │ 10 │ 10 │
2650
+ * │ 20 │ 15 │
2651
+ * │ 30 │ 25 │
2652
+ * └─────┴───────┘
2653
+ */
2654
+ rollingMedian(windowSize: number): this;
2655
+ /**
2656
+ * Window: Computes rolling window minimum value.
2657
+ * @param windowSize Size of rolling window.
2658
+ * @returns ColumnExpression
2659
+ * @example
2660
+ * >>> const df = $df.data({ a: [1, 2, 3] })
2661
+ * >>> df
2662
+ * shape: (3, 1)
2663
+ * ┌───┐
2664
+ * │ a │
2665
+ * ├───┤
2666
+ * │ 1 │
2667
+ * │ 2 │
2668
+ * │ 3 │
2669
+ * └───┘
2670
+ * >>> df.withColumns($df.col("val").rollingMin(2).alias("r_min"))
2671
+ * shape: (3, 2)
2672
+ * ┌─────┬───────┐
2673
+ * │ val │ r_min │
2674
+ * ├─────┼───────┤
2675
+ * │ 10 │ 10 │
2676
+ * │ 20 │ 10 │
2677
+ * │ 30 │ 20 │
2678
+ * └─────┴───────┘
2679
+ */
2680
+ rollingMin(windowSize: number): this;
2681
+ /**
2682
+ * Window: Computes rolling window quantile value.
2683
+ * @param quantile Quantile boundary between 0.0 and 1.0.
2684
+ * @param windowSize Size of rolling window.
2685
+ * @returns ColumnExpression
2686
+ * @example
2687
+ * >>> const df = $df.data({ a: [1, 2, 3] })
2688
+ * >>> df
2689
+ * shape: (3, 1)
2690
+ * ┌───┐
2691
+ * │ a │
2692
+ * ├───┤
2693
+ * │ 1 │
2694
+ * │ 2 │
2695
+ * │ 3 │
2696
+ * └───┘
2697
+ * >>> df.withColumns($df.col("val").rollingQuantile(0.5, 2).alias("r_quant"))
2698
+ * shape: (3, 2)
2699
+ * ┌─────┬─────────┐
2700
+ * │ val │ r_quant │
2701
+ * ├─────┼─────────┤
2702
+ * │ 10 │ 10 │
2703
+ * │ 20 │ 15 │
2704
+ * │ 30 │ 25 │
2705
+ * └─────┴─────────┘
2706
+ */
2707
+ rollingQuantile(quantile: number, windowSize: number): this;
2708
+ /**
2709
+ * Window: Computes rolling window rank.
2710
+ * @param windowSize Size of rolling window.
2711
+ * @returns ColumnExpression
2712
+ * @example
2713
+ * >>> const df = $df.data({ a: [1, 2, 3] })
2714
+ * >>> df
2715
+ * shape: (3, 1)
2716
+ * ┌───┐
2717
+ * │ a │
2718
+ * ├───┤
2719
+ * │ 1 │
2720
+ * │ 2 │
2721
+ * │ 3 │
2722
+ * └───┘
2723
+ * >>> df.withColumns($df.col("val").rollingRank(2).alias("r_rank"))
2724
+ * shape: (3, 2)
2725
+ * ┌─────┬────────┐
2726
+ * │ val │ r_rank │
2727
+ * ├─────┼────────┤
2728
+ * │ 10 │ 1 │
2729
+ * │ 20 │ 2 │
2730
+ * │ 30 │ 2 │
2731
+ * └─────┴────────┘
2732
+ */
2733
+ rollingRank(windowSize: number): this;
2734
+ /**
2735
+ * Window: Computes rolling window standard deviation.
2736
+ * @param windowSize Size of rolling window.
2737
+ * @returns ColumnExpression
2738
+ * @example
2739
+ * >>> const df = $df.data({ a: [1, 2, 3] })
2740
+ * >>> df
2741
+ * shape: (3, 1)
2742
+ * ┌───┐
2743
+ * │ a │
2744
+ * ├───┤
2745
+ * │ 1 │
2746
+ * │ 2 │
2747
+ * │ 3 │
2748
+ * └───┘
2749
+ * >>> df.withColumns($df.col("val").rollingStd(2).alias("r_std"))
2750
+ * shape: (3, 2)
2751
+ * ┌─────┬────────┐
2752
+ * │ val │ r_std │
2753
+ * ├─────┼────────┤
2754
+ * │ 10 │ 0 │
2755
+ * │ 20 │ 7.071 │
2756
+ * │ 30 │ 7.071 │
2757
+ * └─────┴────────┘
2758
+ */
2759
+ rollingStd(windowSize: number): this;
2760
+ /**
2761
+ * Window: Computes rolling window sum.
2762
+ * @param windowSize Size of rolling window.
2763
+ * @returns ColumnExpression
2764
+ * @example
2765
+ * >>> const df = $df.data({ a: [1, 2, 3] })
2766
+ * >>> df
2767
+ * shape: (3, 1)
2768
+ * ┌───┐
2769
+ * │ a │
2770
+ * ├───┤
2771
+ * │ 1 │
2772
+ * │ 2 │
2773
+ * │ 3 │
2774
+ * └───┘
2775
+ * >>> df.withColumns($df.col("val").rollingSum(2).alias("r_sum"))
2776
+ * shape: (3, 2)
2777
+ * ┌─────┬───────┐
2778
+ * │ val │ r_sum │
2779
+ * ├─────┼───────┤
2780
+ * │ 10 │ 10 │
2781
+ * │ 20 │ 30 │
2782
+ * │ 30 │ 50 │
2783
+ * └─────┴───────┘
2784
+ */
2785
+ rollingSum(windowSize: number): this;
2786
+ /**
2787
+ * Rounds values to a specific scale of decimal digits.
2788
+ * @param decimals Number of decimal places to round to (default: 0).
2789
+ * @returns ColumnExpression
2790
+ * @example
2791
+ * >>> const df = $df.data({ a: [1, 2, 3] })
2792
+ * >>> df
2793
+ * shape: (3, 1)
2794
+ * ┌───┐
2795
+ * │ a │
2796
+ * ├───┤
2797
+ * │ 1 │
2798
+ * │ 2 │
2799
+ * │ 3 │
2800
+ * └───┘
2801
+ * >>> df.withColumns($df.col("a").round(1).alias("rounded"))
2802
+ * shape: (3, 2)
2803
+ * ┌───┬─────────┐
2804
+ * │ a │ rounded │
2805
+ * ├───┼─────────┤
2806
+ * │ 1 │ 1 │
2807
+ * │ 2 │ 2 │
2808
+ * │ 3 │ 3 │
2809
+ * └───┴─────────┘
2810
+ */
2811
+ round(decimals?: number): this;
2812
+ /**
2813
+ * Rounds values to a specific number of significant figures.
2814
+ * @param sigFigs Number of significant figures.
2815
+ * @returns ColumnExpression
2816
+ * @example
2817
+ * >>> const df = $df.data({ a: [1, 2, 3] })
2818
+ * >>> df
2819
+ * shape: (3, 1)
2820
+ * ┌───┐
2821
+ * │ a │
2822
+ * ├───┤
2823
+ * │ 1 │
2824
+ * │ 2 │
2825
+ * │ 3 │
2826
+ * └───┘
2827
+ * >>> df.withColumns($df.col("a").roundSigFigs(2).alias("sig_figs"))
2828
+ * shape: (3, 2)
2829
+ * ┌───┬──────────┐
2830
+ * │ a │ sig_figs │
2831
+ * ├───┼──────────┤
2832
+ * │ 1 │ 1 │
2833
+ * │ 2 │ 2 │
2834
+ * │ 3 │ 3 │
2835
+ * └───┴──────────┘
2836
+ */
2837
+ roundSigFigs(sigFigs: number): this;
2838
+ /**
2839
+ * Window: Computes 1-indexed row number count within group partitions.
2840
+ * @returns ColumnExpression
2841
+ * @example
2842
+ * >>> const df = $df.data({ group: ["A", "A", "B"], val: [10, 20, 30] })
2843
+ * >>> df
2844
+ * shape: (3, 2)
2845
+ * ┌───────┬─────┐
2846
+ * │ group │ val │
2847
+ * ├───────┼─────┤
2848
+ * │ A │ 10 │
2849
+ * │ A │ 20 │
2850
+ * │ B │ 30 │
2851
+ * └───────┴─────┘
2852
+ * >>> df.withColumns($df.col("val").rowNumber().over("group").alias("rn"))
2853
+ * shape: (3, 3)
2854
+ * ┌───────┬─────┬────┐
2855
+ * │ group │ val │ rn │
2856
+ * ├───────┼─────┼────┤
2857
+ * │ A │ 10 │ 1 │
2858
+ * │ A │ 20 │ 2 │
2859
+ * │ B │ 30 │ 1 │
2860
+ * └───────┴─────┴────┘
2861
+ */
2862
+ rowNumber(): this;
2863
+ /**
2864
+ * Returns sign indicator of column values (-1, 0, or 1).
2865
+ * @returns ColumnExpression
2866
+ * @example
2867
+ * >>> const df = $df.data({ a: [1, 2, 3] })
2868
+ * >>> df
2869
+ * shape: (3, 1)
2870
+ * ┌───┐
2871
+ * │ a │
2872
+ * ├───┤
2873
+ * │ 1 │
2874
+ * │ 2 │
2875
+ * │ 3 │
2876
+ * └───┘
2877
+ * >>> df.withColumns($df.col("a").sign().alias("sign_a"))
2878
+ * shape: (3, 2)
2879
+ * ┌───┬────────┐
2880
+ * │ a │ sign_a │
2881
+ * ├───┼────────┤
2882
+ * │ 1 │ 1 │
2883
+ * │ 2 │ 1 │
2884
+ * │ 3 │ 1 │
2885
+ * └───┴────────┘
2886
+ */
2887
+ sign(): this;
2888
+ /**
2889
+ * Computes the sine of the column values.
2890
+ * @returns ColumnExpression
2891
+ * @example
2892
+ * >>> const df = $df.data({ a: [1, 2, 3] })
2893
+ * >>> df
2894
+ * shape: (3, 1)
2895
+ * ┌───┐
2896
+ * │ a │
2897
+ * ├───┤
2898
+ * │ 1 │
2899
+ * │ 2 │
2900
+ * │ 3 │
2901
+ * └───┘
2902
+ * >>> df.withColumns($df.col("a").sin().alias("sin_a"))
2903
+ * shape: (3, 2)
2904
+ * ┌───┬──────────┐
2905
+ * │ a │ sin_a │
2906
+ * ├───┼──────────┤
2907
+ * │ 1 │ 0.841471 │
2908
+ * │ 2 │ 0.909297 │
2909
+ * │ 3 │ 0.14112 │
2910
+ * └───┴──────────┘
2911
+ */
2912
+ sin(): this;
2913
+ /**
2914
+ * Computes the hyperbolic sine of the column values.
2915
+ * @returns ColumnExpression
2916
+ * @example
2917
+ * >>> const df = $df.data({ a: [1, 2, 3] })
2918
+ * >>> df
2919
+ * shape: (3, 1)
2920
+ * ┌───┐
2921
+ * │ a │
2922
+ * ├───┤
2923
+ * │ 1 │
2924
+ * │ 2 │
2925
+ * │ 3 │
2926
+ * └───┘
2927
+ * >>> df.withColumns($df.col("a").sinh().alias("sinh_a"))
2928
+ * shape: (3, 2)
2929
+ * ┌───┬───────────┐
2930
+ * │ a │ sinh_a │
2931
+ * ├───┼───────────┤
2932
+ * │ 1 │ 1.175201 │
2933
+ * │ 2 │ 3.62686 │
2934
+ * │ 3 │ 10.017875 │
2935
+ * └───┴───────────┘
2936
+ */
2937
+ sinh(): this;
2938
+ /**
2939
+ * Aggregation: Computes the sample skewness as the Fisher-Pearson coefficient of skewness.
2940
+ * @param options Skew calculation options ({ bias?: boolean }, default bias=true).
2941
+ * @returns ColumnExpression
2942
+ * @example
2943
+ * >>> const df = $df.data({ a: [1, 2, 3] })
2944
+ * >>> df
2945
+ * shape: (3, 1)
2946
+ * ┌───┐
2947
+ * │ a │
2948
+ * ├───┤
2949
+ * │ 1 │
2950
+ * │ 2 │
2951
+ * │ 3 │
2952
+ * └───┘
2953
+ * >>> df.select($df.col("a").skew().alias("skewness"))
2954
+ * shape: (1, 1)
2955
+ * ┌──────────┐
2956
+ * │ skewness │
2957
+ * ├──────────┤
2958
+ * │ 0 │
2959
+ * └──────────┘
2960
+ */
2961
+ skew(options?: SkewOptions): this;
2962
+ /**
2963
+ * Aggregation: Computes the Spearman rank correlation coefficient.
2964
+ * @param other The other column expression to correlate with.
2965
+ * @returns ColumnExpression
2966
+ * @example
2967
+ * >>> const df = $df.data({ a: [1, 2, 3], b: [10, 20, 30] })
2968
+ * >>> df
2969
+ * shape: (3, 2)
2970
+ * ┌───┬────┐
2971
+ * │ a │ b │
2972
+ * ├───┼────┤
2973
+ * │ 1 │ 10 │
2974
+ * │ 2 │ 20 │
2975
+ * │ 3 │ 30 │
2976
+ * └───┴────┘
2977
+ * >>> df.select($df.col("a").spearmanCorr($df.col("b")).alias("spearman"))
2978
+ * shape: (1, 1)
2979
+ * ┌──────────┐
2980
+ * │ spearman │
2981
+ * ├──────────┤
2982
+ * │ 1 │
2983
+ * └──────────┘
2984
+ */
2985
+ spearmanCorr(other: any): this;
2986
+ /**
2987
+ * Computes the square root of non-negative column values.
2988
+ * @returns ColumnExpression
2989
+ * @example
2990
+ * >>> const df = $df.data({ a: [1, 2, 3] })
2991
+ * >>> df
2992
+ * shape: (3, 1)
2993
+ * ┌───┐
2994
+ * │ a │
2995
+ * ├───┤
2996
+ * │ 1 │
2997
+ * │ 2 │
2998
+ * │ 3 │
2999
+ * └───┘
3000
+ * >>> df.withColumns($df.col("a").sqrt().alias("sqrt_a"))
3001
+ * shape: (3, 2)
3002
+ * ┌───┬──────────┐
3003
+ * │ a │ sqrt_a │
3004
+ * ├───┼──────────┤
3005
+ * │ 1 │ 1 │
3006
+ * │ 2 │ 1.414214 │
3007
+ * │ 3 │ 1.732051 │
3008
+ * └───┴──────────┘
3009
+ */
3010
+ sqrt(): this;
3011
+ /**
3012
+ * Aggregation: Computes sample standard deviation.
3013
+ * @returns ColumnExpression
3014
+ * @example
3015
+ * >>> const df = $df.data({ a: [1, 2, 3] })
3016
+ * >>> df
3017
+ * shape: (3, 1)
3018
+ * ┌───┐
3019
+ * │ a │
3020
+ * ├───┤
3021
+ * │ 1 │
3022
+ * │ 2 │
3023
+ * │ 3 │
3024
+ * └───┘
3025
+ * >>> df.select($df.col("val").std().alias("std_dev"))
3026
+ * shape: (1, 1)
3027
+ * ┌─────────┐
3028
+ * │ std_dev │
3029
+ * ├─────────┤
3030
+ * │ 10 │
3031
+ * └─────────┘
3032
+ */
3033
+ std(): this;
3034
+ /**
3035
+ * Subtracts a scalar or another column expression.
3036
+ * @param val The value or column expression to subtract.
3037
+ * @returns ColumnExpression
3038
+ * @example
3039
+ * >>> const df = $df.data({ a: [1, 2, 3] })
3040
+ * >>> df
3041
+ * shape: (3, 1)
3042
+ * ┌───┐
3043
+ * │ a │
3044
+ * ├───┤
3045
+ * │ 1 │
3046
+ * │ 2 │
3047
+ * │ 3 │
3048
+ * └───┘
3049
+ * >>> df.withColumns($df.col("a").sub(5).alias("sub_a"))
3050
+ * shape: (3, 2)
3051
+ * ┌───┬───────┐
3052
+ * │ a │ sub_a │
3053
+ * ├───┼───────┤
3054
+ * │ 1 │ -4 │
3055
+ * │ 2 │ -3 │
3056
+ * │ 3 │ -2 │
3057
+ * └───┴───────┘
3058
+ */
3059
+ sub(val: NumericArg): this;
3060
+ /**
3061
+ * Aggregation: Computes the sum of elements in the group.
3062
+ * @returns ColumnExpression
3063
+ * @example
3064
+ * >>> const df = $df.data({ group: ["A", "A", "B"], val: [10, 20, 30] })
3065
+ * >>> df
3066
+ * shape: (3, 2)
3067
+ * ┌───────┬─────┐
3068
+ * │ group │ val │
3069
+ * ├───────┼─────┤
3070
+ * │ A │ 10 │
3071
+ * │ A │ 20 │
3072
+ * │ B │ 30 │
3073
+ * └───────┴─────┘
3074
+ * >>> df.groupBy("group").agg($df.col("val").sum().alias("total"))
3075
+ * shape: (2, 2)
3076
+ * ┌───────┬───────┐
3077
+ * │ group │ total │
3078
+ * ├───────┼───────┤
3079
+ * │ A │ 30 │
3080
+ * │ B │ 30 │
3081
+ * └───────┴───────┘
3082
+ */
3083
+ sum(): this;
3084
+ /**
3085
+ * Computes the tangent of the column values.
3086
+ * @returns ColumnExpression
3087
+ * @example
3088
+ * >>> const df = $df.data({ a: [1, 2, 3] })
3089
+ * >>> df
3090
+ * shape: (3, 1)
3091
+ * ┌───┐
3092
+ * │ a │
3093
+ * ├───┤
3094
+ * │ 1 │
3095
+ * │ 2 │
3096
+ * │ 3 │
3097
+ * └───┘
3098
+ * >>> df.withColumns($df.col("a").tan().alias("tan_a"))
3099
+ * shape: (3, 2)
3100
+ * ┌───┬───────────┐
3101
+ * │ a │ tan_a │
3102
+ * ├───┼───────────┤
3103
+ * │ 1 │ 1.557408 │
3104
+ * │ 2 │ -2.18504 │
3105
+ * │ 3 │ -0.142547 │
3106
+ * └───┴───────────┘
3107
+ */
3108
+ tan(): this;
3109
+ /**
3110
+ * Computes the hyperbolic tangent of the column values.
3111
+ * @returns ColumnExpression
3112
+ * @example
3113
+ * >>> const df = $df.data({ a: [1, 2, 3] })
3114
+ * >>> df
3115
+ * shape: (3, 1)
3116
+ * ┌───┐
3117
+ * │ a │
3118
+ * ├───┤
3119
+ * │ 1 │
3120
+ * │ 2 │
3121
+ * │ 3 │
3122
+ * └───┘
3123
+ * >>> df.withColumns($df.col("a").tanh().alias("tanh_a"))
3124
+ * shape: (3, 2)
3125
+ * ┌───┬──────────┐
3126
+ * │ a │ tanh_a │
3127
+ * ├───┼──────────┤
3128
+ * │ 1 │ 0.761594 │
3129
+ * │ 2 │ 0.964028 │
3130
+ * │ 3 │ 0.995055 │
3131
+ * └───┴──────────┘
3132
+ */
3133
+ tanh(): this;
3134
+ /**
3135
+ * Truncates fractional digits of column values.
3136
+ * @returns ColumnExpression
3137
+ * @example
3138
+ * >>> const df = $df.data({ a: [1, 2, 3] })
3139
+ * >>> df
3140
+ * shape: (3, 1)
3141
+ * ┌───┐
3142
+ * │ a │
3143
+ * ├───┤
3144
+ * │ 1 │
3145
+ * │ 2 │
3146
+ * │ 3 │
3147
+ * └───┘
3148
+ * >>> df.withColumns($df.col("a").trunc().alias("trunc_a"))
3149
+ * shape: (3, 2)
3150
+ * ┌───┬─────────┐
3151
+ * │ a │ trunc_a │
3152
+ * ├───┼─────────┤
3153
+ * │ 1 │ 1 │
3154
+ * │ 2 │ 2 │
3155
+ * │ 3 │ 3 │
3156
+ * └───┴─────────┘
3157
+ */
3158
+ trunc(): this;
3159
+ /**
3160
+ * Aggregation: Computes sample variance.
3161
+ * @returns ColumnExpression
3162
+ * @example
3163
+ * >>> const df = $df.data({ a: [1, 2, 3] })
3164
+ * >>> df
3165
+ * shape: (3, 1)
3166
+ * ┌───┐
3167
+ * │ a │
3168
+ * ├───┤
3169
+ * │ 1 │
3170
+ * │ 2 │
3171
+ * │ 3 │
3172
+ * └───┘
3173
+ * >>> df.select($df.col("val").variance().alias("v"))
3174
+ * shape: (1, 1)
3175
+ * ┌─────┐
3176
+ * │ v │
3177
+ * ├─────┤
3178
+ * │ 100 │
3179
+ * └─────┘
3180
+ */
3181
+ variance(): this;
3182
+ /**
3183
+ * Aggregation: Computes weighted average.
3184
+ * @param weights The weight values or column expression.
3185
+ * @returns ColumnExpression
3186
+ * @example
3187
+ * >>> const df = $df.data({ a: [1, 2, 3], b: [10, 20, 30] })
3188
+ * >>> df
3189
+ * shape: (3, 2)
3190
+ * ┌───┬────┐
3191
+ * │ a │ b │
3192
+ * ├───┼────┤
3193
+ * │ 1 │ 10 │
3194
+ * │ 2 │ 20 │
3195
+ * │ 3 │ 30 │
3196
+ * └───┴────┘
3197
+ * >>> df.select($df.col("a").wAvg($df.col("b")).alias("w_mean"))
3198
+ * shape: (1, 1)
3199
+ * ┌──────────┐
3200
+ * │ w_mean │
3201
+ * ├──────────┤
3202
+ * │ 2.333333 │
3203
+ * └──────────┘
3204
+ */
3205
+ wAvg(weights: any): this;
3206
+ /**
3207
+ * Logical XOR check.
3208
+ * @param other The other boolean column expression or literal value to compare.
3209
+ * @returns ColumnExpression
3210
+ * @example
3211
+ * >>> const df = $df.data({ a: [true, true, false, false], b: [true, false, true, false] })
3212
+ * >>> df
3213
+ * shape: (4, 2)
3214
+ * ┌───────┬───────┐
3215
+ * │ a │ b │
3216
+ * ├───────┼───────┤
3217
+ * │ true │ true │
3218
+ * │ true │ false │
3219
+ * │ false │ true │
3220
+ * │ false │ false │
3221
+ * └───────┴───────┘
3222
+ * >>> df.withColumns($df.col("a").xor($df.col("b")).alias("xor_res"))
3223
+ * shape: (4, 3)
3224
+ * ┌───────┬───────┬─────────┐
3225
+ * │ a │ b │ xor_res │
3226
+ * ├───────┼───────┼─────────┤
3227
+ * │ true │ true │ false │
3228
+ * │ true │ false │ true │
3229
+ * │ false │ true │ true │
3230
+ * │ false │ false │ false │
3231
+ * └───────┴───────┴─────────┘
3232
+ */
3233
+ xor(other: any): this;
3234
+ }