df-script 1.9.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 (59) hide show
  1. package/README.md +148 -235
  2. package/dist/api.d.ts +41 -36
  3. package/dist/columnExpressions/ColumnExpr.d.ts +5 -8
  4. package/dist/columnExpressions/functions/all.d.ts +13 -13
  5. package/dist/columnExpressions/functions/coalesce.d.ts +2 -2
  6. package/dist/columnExpressions/functions/duration.d.ts +16 -21
  7. package/dist/columnExpressions/functions/element.d.ts +10 -10
  8. package/dist/columnExpressions/functions/exclude.d.ts +14 -14
  9. package/dist/columnExpressions/functions/implode.d.ts +7 -7
  10. package/dist/columnExpressions/functions/lit.d.ts +9 -9
  11. package/dist/columnExpressions/functions/seqRange.d.ts +69 -0
  12. package/dist/columnExpressions/functions/struct.d.ts +6 -6
  13. package/dist/columnExpressions/functions/when.d.ts +25 -28
  14. package/dist/columnExpressions/index.d.ts +3 -7
  15. package/dist/columnExpressions/mixins/AggregationExpr.d.ts +550 -221
  16. package/dist/columnExpressions/mixins/ArithmeticExpr.d.ts +701 -327
  17. package/dist/columnExpressions/mixins/ArrayExpr.d.ts +508 -212
  18. package/dist/columnExpressions/mixins/ComparisonExpr.d.ts +398 -201
  19. package/dist/columnExpressions/mixins/LogicalExpr.d.ts +59 -29
  20. package/dist/columnExpressions/mixins/ManipulationExpr.d.ts +23 -9
  21. package/dist/columnExpressions/mixins/StandardExpr.d.ts +3234 -0
  22. package/dist/columnExpressions/mixins/StringExpr.d.ts +1163 -524
  23. package/dist/columnExpressions/mixins/StructExpr.d.ts +67 -25
  24. package/dist/columnExpressions/mixins/TemporalExpr.d.ts +518 -212
  25. package/dist/columnExpressions/mixins/WindowExpr.d.ts +270 -102
  26. package/dist/columnExpressions/typeInference.d.ts +3 -3
  27. package/dist/columnExpressions/types.d.ts +5 -0
  28. package/dist/columnExpressions/utils.d.ts +7 -0
  29. package/dist/constants.d.ts +11 -2
  30. package/dist/dataframe/dataframe.d.ts +755 -592
  31. package/dist/dataframe/grouped/grouped.d.ts +24 -6
  32. package/dist/dataframe/grouped.d.ts +70 -0
  33. package/dist/dataframe/index.d.ts +1 -1
  34. package/dist/dataframe/lazy.d.ts +37 -0
  35. package/dist/dataframe/types.d.ts +46 -22
  36. package/dist/dataframe/utils.d.ts +10 -4
  37. package/dist/datatypes/index.d.ts +11 -4
  38. package/dist/expressions.js +1 -0
  39. package/dist/expressions.mjs +1 -0
  40. package/dist/functions/concat.d.ts +68 -16
  41. package/dist/functions/index.d.ts +2 -2
  42. package/dist/functions/readCsv.d.ts +35 -0
  43. package/dist/functions/readJson.d.ts +33 -0
  44. package/dist/index.js +5 -6
  45. package/dist/index.mjs +5 -6
  46. package/dist/types.d.ts +42 -9
  47. package/dist/utils/array.d.ts +17 -14
  48. package/dist/utils/csv.d.ts +4 -1
  49. package/dist/utils/date.d.ts +3 -19
  50. package/dist/utils/duration.d.ts +7 -5
  51. package/dist/utils/json.d.ts +5 -3
  52. package/dist/utils/object.d.ts +0 -18
  53. package/dist/utils/string.d.ts +5 -0
  54. package/dist/utils.js +4 -0
  55. package/dist/utils.mjs +4 -0
  56. package/package.json +29 -8
  57. package/dist/assets/index-DBhGK6Tp.css +0 -1
  58. package/dist/assets/index-DEJEV_tU.js +0 -195
  59. package/dist/index.html +0 -17
@@ -1,6 +1,6 @@
1
1
  import { ExprBase } from "../ExprBase";
2
- import { SortArrayOptions, StepSliceArrayOptions } from "../../utils";
3
- import type { UniqueArrayStatsOptions, JoinArrayOptions, ExplodeOptions, IExpr, AnyTypedArray, ToStructOptions } from "../../types";
2
+ import { UniqueArrayStatsOptions, StepSliceArrayOptions, JoinArrayOptions } from "../../utils";
3
+ import type { SortArrayOptions, ExplodeOptions, IExpr, AnyTypedArray, ToStructOptions } from "../../types";
4
4
  /**
5
5
  * @namespace $df.col.arr
6
6
  * @category ColumnExpression
@@ -10,13 +10,22 @@ export declare class ArrayExprNamespace {
10
10
  expr: any;
11
11
  constructor(expr: any);
12
12
  _deriveArray(fn: (arr: any[] | AnyTypedArray) => any): any;
13
+ _deriveArrayBinary(other: any, fn: (arr: any[] | AnyTypedArray, val: any) => any): any;
13
14
  /**
14
15
  * Applies an aggregation expression or element-wise calculation over each array cell.
15
16
  * @param expr Aggregation expression (e.g. $df.element().sum() or $df.element().max())
16
17
  * @returns ColumnExpression
17
18
  * @example
18
- * >>> const df = $df.data({ a: [[1, 2, 3], [4, 5]] })
19
- * >>> df.with_columns($df.col("a").arr.agg($df.element().sum()).alias("sum_a"))
19
+ * >>> const df = $df.data({ a: [[1, 2, 3], [4, 5]] })
20
+ * >>> df
21
+ * shape: (2, 1)
22
+ * ┌───────────┐
23
+ * │ a │
24
+ * ├───────────┤
25
+ * │ [1, 2, 3] │
26
+ * │ [4, 5] │
27
+ * └───────────┘
28
+ * >>> df.withColumns($df.col("a").arr.agg($df.element().sum()).alias("sum_a"))
20
29
  * shape: (2, 2)
21
30
  * ┌───────────┬───────┐
22
31
  * │ a │ sum_a │
@@ -30,8 +39,16 @@ export declare class ArrayExprNamespace {
30
39
  * Returns true if all items in nested list cells are truthy.
31
40
  * @returns ColumnExpression
32
41
  * @example
33
- * >>> const df = $df.data({ a: [[true, true], [true, false]] })
34
- * >>> df.with_columns($df.col("a").arr.all().alias("all_true"))
42
+ * >>> const df = $df.data({ a: [[1, 2, 3], [4, 5]] })
43
+ * >>> df
44
+ * shape: (2, 1)
45
+ * ┌───────────┐
46
+ * │ a │
47
+ * ├───────────┤
48
+ * │ [1, 2, 3] │
49
+ * │ [4, 5] │
50
+ * └───────────┘
51
+ * >>> df.withColumns($df.col("a").arr.all().alias("all_true"))
35
52
  * shape: (2, 2)
36
53
  * ┌───────────────┬──────────┐
37
54
  * │ a │ all_true │
@@ -45,54 +62,86 @@ export declare class ArrayExprNamespace {
45
62
  * Returns true if any item in nested list cells is truthy.
46
63
  * @returns ColumnExpression
47
64
  * @example
48
- * >>> const df = $df.data({ a: [[true, false], [false, false]] })
49
- * >>> df.with_columns($df.col("a").arr.any().alias("any_true"))
65
+ * >>> const df = $df.data({ a: [[1, 2, 3], [4, 5]] })
66
+ * >>> df
67
+ * shape: (2, 1)
68
+ * ┌───────────┐
69
+ * │ a │
70
+ * ├───────────┤
71
+ * │ [1, 2, 3] │
72
+ * │ [4, 5] │
73
+ * └───────────┘
74
+ * >>> df.withColumns($df.col("a").arr.any().alias("any_true"))
50
75
  * shape: (2, 2)
51
- * ┌────────────────┬──────────┐
52
- * │ a │ any_true │
53
- * ├────────────────┼──────────┤
54
- * │ [true, false] │ true │
55
- * │ [false, false] │ false
56
- * └────────────────┴──────────┘
76
+ * ┌───────────────┬──────────┐
77
+ * │ a │ any_true │
78
+ * ├───────────────┼──────────┤
79
+ * │ [true, true] │ true │
80
+ * │ [true, false] │ true
81
+ * └───────────────┴──────────┘
57
82
  */
58
83
  any(): any;
59
84
  /**
60
85
  * Finds the index of the maximum value in each array.
61
86
  * @returns ColumnExpression
62
87
  * @example
63
- * >>> const df = $df.data({ a: [[1, 5, 2], [10, 4]] })
64
- * >>> df.with_columns($df.col("a").arr.arg_max().alias("max_idx"))
88
+ * >>> const df = $df.data({ a: [[1, 2, 3], [4, 5]] })
89
+ * >>> df
90
+ * shape: (2, 1)
91
+ * ┌───────────┐
92
+ * │ a │
93
+ * ├───────────┤
94
+ * │ [1, 2, 3] │
95
+ * │ [4, 5] │
96
+ * └───────────┘
97
+ * >>> df.withColumns($df.col("a").arr.argMax().alias("max_idx"))
65
98
  * shape: (2, 2)
66
99
  * ┌───────────┬─────────┐
67
100
  * │ a │ max_idx │
68
101
  * ├───────────┼─────────┤
69
- * │ [1, 5, 2] │ 1
70
- * │ [10, 4] 0
102
+ * │ [1, 2, 3] │ 2
103
+ * │ [4, 5] 1
71
104
  * └───────────┴─────────┘
72
105
  */
73
- arg_max(): any;
106
+ argMax(): any;
74
107
  /**
75
108
  * Finds the index of the minimum value in each array.
76
109
  * @returns ColumnExpression
77
110
  * @example
78
- * >>> const df = $df.data({ a: [[5, 1, 2], [10, 4]] })
79
- * >>> df.with_columns($df.col("a").arr.arg_min().alias("min_idx"))
111
+ * >>> const df = $df.data({ a: [[1, 2, 3], [4, 5]] })
112
+ * >>> df
113
+ * shape: (2, 1)
114
+ * ┌───────────┐
115
+ * │ a │
116
+ * ├───────────┤
117
+ * │ [1, 2, 3] │
118
+ * │ [4, 5] │
119
+ * └───────────┘
120
+ * >>> df.withColumns($df.col("a").arr.argMin().alias("min_idx"))
80
121
  * shape: (2, 2)
81
122
  * ┌───────────┬─────────┐
82
123
  * │ a │ min_idx │
83
124
  * ├───────────┼─────────┤
84
- * │ [5, 1, 2] │ 1
85
- * │ [10, 4] 1
125
+ * │ [1, 2, 3] │ 0
126
+ * │ [4, 5] 0
86
127
  * └───────────┴─────────┘
87
128
  */
88
- arg_min(): any;
129
+ argMin(): any;
89
130
  /**
90
131
  * Checks if nested lists contain item.
91
132
  * @param item The element to search for.
92
133
  * @returns ColumnExpression
93
134
  * @example
94
- * >>> const df = $df.data({ a: [[1, 2, 3], [4, 5]] })
95
- * >>> df.with_columns($df.col("a").arr.contains(3).alias("has_three"))
135
+ * >>> const df = $df.data({ a: [[1, 2, 3], [4, 5]] })
136
+ * >>> df
137
+ * shape: (2, 1)
138
+ * ┌───────────┐
139
+ * │ a │
140
+ * ├───────────┤
141
+ * │ [1, 2, 3] │
142
+ * │ [4, 5] │
143
+ * └───────────┘
144
+ * >>> df.withColumns($df.col("a").arr.contains(3).alias("has_three"))
96
145
  * shape: (2, 2)
97
146
  * ┌───────────┬───────────┐
98
147
  * │ a │ has_three │
@@ -107,24 +156,40 @@ export declare class ArrayExprNamespace {
107
156
  * @param items Array of elements that must all be present.
108
157
  * @returns ColumnExpression
109
158
  * @example
110
- * >>> const df = $df.data({ a: [[1, 2, 3], [1, 5]] })
111
- * >>> df.with_columns($df.col("a").arr.contains_all([1, 2]).alias("has_all"))
159
+ * >>> const df = $df.data({ a: [[1, 2, 3], [4, 5]] })
160
+ * >>> df
161
+ * shape: (2, 1)
162
+ * ┌───────────┐
163
+ * │ a │
164
+ * ├───────────┤
165
+ * │ [1, 2, 3] │
166
+ * │ [4, 5] │
167
+ * └───────────┘
168
+ * >>> df.withColumns($df.col("a").arr.containsAll([1, 2]).alias("has_all"))
112
169
  * shape: (2, 2)
113
170
  * ┌───────────┬─────────┐
114
171
  * │ a │ has_all │
115
172
  * ├───────────┼─────────┤
116
173
  * │ [1, 2, 3] │ true │
117
- * │ [1, 5] │ false │
174
+ * │ [4, 5] │ false │
118
175
  * └───────────┴─────────┘
119
176
  */
120
- contains_all(items: ArrayLike<any>): any;
177
+ containsAll(items: ArrayLike<any>): any;
121
178
  /**
122
179
  * Checks if nested lists contain any element in items.
123
180
  * @param items Array of elements where at least one must be present.
124
181
  * @returns ColumnExpression
125
182
  * @example
126
- * >>> const df = $df.data({ a: [[1, 2], [3, 4]] })
127
- * >>> df.with_columns($df.col("a").arr.contains_any([2, 3]).alias("has_any"))
183
+ * >>> const df = $df.data({ a: [[1, 2, 3], [4, 5]] })
184
+ * >>> df
185
+ * shape: (2, 1)
186
+ * ┌───────────┐
187
+ * │ a │
188
+ * ├───────────┤
189
+ * │ [1, 2, 3] │
190
+ * │ [4, 5] │
191
+ * └───────────┘
192
+ * >>> df.withColumns($df.col("a").arr.containsAny([2, 3]).alias("has_any"))
128
193
  * shape: (2, 2)
129
194
  * ┌────────┬─────────┐
130
195
  * │ a │ has_any │
@@ -133,38 +198,54 @@ export declare class ArrayExprNamespace {
133
198
  * │ [3, 4] │ true │
134
199
  * └────────┴─────────┘
135
200
  */
136
- contains_any(items: ArrayLike<any>): any;
201
+ containsAny(items: ArrayLike<any>): any;
137
202
  /**
138
203
  * Counts occurrence frequency of item inside nested lists.
139
204
  * @param item The value to count occurrences of.
140
205
  * @param options Statistics and matching options.
141
206
  * @returns ColumnExpression
142
207
  * @example
143
- * >>> const df = $df.data({ a: [[1, 2, 2, 3], [4, 5]] })
144
- * >>> df.with_columns($df.col("a").arr.count_matches(2).alias("twos"))
208
+ * >>> const df = $df.data({ a: [[1, 2, 3], [4, 5]] })
209
+ * >>> df
210
+ * shape: (2, 1)
211
+ * ┌───────────┐
212
+ * │ a │
213
+ * ├───────────┤
214
+ * │ [1, 2, 3] │
215
+ * │ [4, 5] │
216
+ * └───────────┘
217
+ * >>> df.withColumns($df.col("a").arr.countMatches(2).alias("twos"))
145
218
  * shape: (2, 2)
146
- * ┌──────────────┬──────┐
147
- * │ a │ twos │
148
- * ├──────────────┼──────┤
149
- * │ [1, 2, 2, 3] │ 2
150
- * │ [4, 5] │ 0 │
151
- * └──────────────┴──────┘
219
+ * ┌───────────┬──────┐
220
+ * │ a │ twos │
221
+ * ├───────────┼──────┤
222
+ * │ [1, 2, 3] │ 1
223
+ * │ [4, 5] │ 0 │
224
+ * └───────────┴──────┘
152
225
  */
153
- count_matches(item: any, options?: UniqueArrayStatsOptions): any;
226
+ countMatches(item: any, options?: UniqueArrayStatsOptions): any;
154
227
  /**
155
228
  * Filters elements of list columns matching a boolean sub-expression.
156
229
  * @param expr The boolean column expression to filter by.
157
230
  * @returns ColumnExpression
158
231
  * @example
159
- * >>> const df = $df.data({ a: [[1, 5, 10], [2, 8]] })
160
- * >>> df.with_columns($df.col("a").arr.filter($df.element().gt(4)).alias("filtered"))
161
- * shape: (2, 2)
162
- * ┌────────────┬──────────┐
163
- * │ a filtered │
164
- * ├────────────┼──────────┤
165
- * │ [1, 5, 10] │ [5, 10] │
166
- * │ [2, 8] [8] │
167
- * └────────────┴──────────┘
232
+ * >>> const df = $df.data({ a: [[1, 2, 3], [4, 5]] })
233
+ * >>> df
234
+ * shape: (2, 1)
235
+ * ┌───────────┐
236
+ * │ a
237
+ * ├───────────┤
238
+ * │ [1, 2, 3] │
239
+ * │ [4, 5]
240
+ * └───────────┘
241
+ * >>> df.withColumns($df.col("a").arr.filter($df.element().gt(2)).alias("filtered"))
242
+ * shape: (2, 2)
243
+ * ┌───────────┬──────────┐
244
+ * │ a │ filtered │
245
+ * ├───────────┼──────────┤
246
+ * │ [1, 2, 3] │ [3] │
247
+ * │ [4, 5] │ [4, 5] │
248
+ * └───────────┴──────────┘
168
249
  */
169
250
  filter(expr: IExpr): any;
170
251
  /**
@@ -172,117 +253,172 @@ export declare class ArrayExprNamespace {
172
253
  * @param options Config options including handling of empty arrays and nulls.
173
254
  * @returns ColumnExpression
174
255
  * @example
175
- * >>> const df = $df.data({ id: [1, 2], values: [[10, 20], [30]] })
176
- * >>> df.select([$df.col("id"), $df.col("values").arr.explode()])
177
- * shape: (3, 2)
178
- * ┌─────┬────────┐
179
- * │ id values │
180
- * ├─────┼────────┤
181
- * │ 1 10
182
- * │ 1 │ 20
183
- * │ 2 │ 30 │
184
- * └─────┴────────┘
256
+ * >>> const df = $df.data({ a: [[1, 2, 3], [4, 5]] })
257
+ * >>> df
258
+ * shape: (2, 1)
259
+ * ┌───────────┐
260
+ * │ a
261
+ * ├───────────┤
262
+ * │ [1, 2, 3]
263
+ * │ [4, 5]
264
+ * └───────────┘
265
+ * >>> df.select([$df.col("group"), $df.col("values").arr.explode()])
266
+ * shape: (2, 2)
267
+ * ┌───────┬────────┐
268
+ * │ group │ values │
269
+ * ├───────┼────────┤
270
+ * │ A │ 1 │
271
+ * │ A │ 2 │
272
+ * └───────┴────────┘
185
273
  */
186
- explode({ empty_as_null, keep_nulls }?: ExplodeOptions): any;
274
+ explode({ emptyAsNull, keepNulls }?: ExplodeOptions): any;
187
275
  /**
188
276
  * Returns the first element of each list.
189
- * @param null_on_oob If true, returns null if the list is empty (default: true).
277
+ * @param nullOnOob If true, returns null if the list is empty (default: true).
190
278
  * @returns ColumnExpression
191
279
  * @example
192
- * >>> const df = $df.data({ a: [[10, 20], [30]] })
193
- * >>> df.with_columns($df.col("a").arr.first().alias("first_a"))
280
+ * >>> const df = $df.data({ a: [[1, 2, 3], [4, 5]] })
281
+ * >>> df
282
+ * shape: (2, 1)
283
+ * ┌───────────┐
284
+ * │ a │
285
+ * ├───────────┤
286
+ * │ [1, 2, 3] │
287
+ * │ [4, 5] │
288
+ * └───────────┘
289
+ * >>> df.withColumns($df.col("a").arr.first().alias("first_a"))
194
290
  * shape: (2, 2)
195
- * ┌──────────┬─────────┐
196
- * │ a │ first_a │
197
- * ├──────────┼─────────┤
198
- * │ [10, 20] │ 10
199
- * │ [30] 30
200
- * └──────────┴─────────┘
291
+ * ┌───────────┬─────────┐
292
+ * │ a │ first_a │
293
+ * ├───────────┼─────────┤
294
+ * │ [1, 2, 3] │ 1
295
+ * │ [4, 5] 4
296
+ * └───────────┴─────────┘
201
297
  */
202
- first(null_on_oob?: boolean): any;
298
+ first(nullOnOob?: boolean): any;
203
299
  /**
204
300
  * Gathers specific indices from each nested list.
205
301
  * @param indices Index or array of indices to extract.
206
- * @param null_on_oob If true, returns null for indices out of bounds (default: true).
302
+ * @param nullOnOob If true, returns null for indices out of bounds (default: true).
207
303
  * @returns ColumnExpression
208
304
  * @example
209
- * >>> const df = $df.data({ a: [[10, 20, 30], [40, 50]] })
210
- * >>> df.with_columns($df.col("a").arr.gather([0, 2]).alias("g"))
305
+ * >>> const df = $df.data({ a: [[1, 2, 3], [4, 5]] })
306
+ * >>> df
307
+ * shape: (2, 1)
308
+ * ┌───────────┐
309
+ * │ a │
310
+ * ├───────────┤
311
+ * │ [1, 2, 3] │
312
+ * │ [4, 5] │
313
+ * └───────────┘
314
+ * >>> df.withColumns($df.col("a").arr.gather([0, 2]).alias("g"))
211
315
  * shape: (2, 2)
212
- * ┌──────────────┬──────────┐
213
- * │ a │ g │
214
- * ├──────────────┼──────────┤
215
- * │ [10, 20, 30] │ [10, 30]
216
- * │ [40, 50] │ [40, null]│
217
- * └──────────────┴──────────┘
316
+ * ┌───────────┬──────────┐
317
+ * │ a │ g │
318
+ * ├───────────┼──────────┤
319
+ * │ [1, 2, 3] │ [1, 3]
320
+ * │ [4, 5] │ [4, null]│
321
+ * └───────────┴──────────┘
218
322
  */
219
- gather(indices: number | ArrayLike<number>, null_on_oob?: boolean): any;
323
+ gather(indices: number | ArrayLike<number>, nullOnOob?: boolean): any;
220
324
  /**
221
325
  * Gather element slices with custom steps.
222
326
  * @param options Config options including offset, limit, and step size.
223
327
  * @returns ColumnExpression
224
328
  * @example
225
- * >>> const df = $df.data({ a: [[1, 2, 3, 4], [5, 6, 7]] })
226
- * >>> df.with_columns($df.col("a").arr.gather_every({ step: 2 }).alias("ge"))
329
+ * >>> const df = $df.data({ a: [[1, 2, 3], [4, 5]] })
330
+ * >>> df
331
+ * shape: (2, 1)
332
+ * ┌───────────┐
333
+ * │ a │
334
+ * ├───────────┤
335
+ * │ [1, 2, 3] │
336
+ * │ [4, 5] │
337
+ * └───────────┘
338
+ * >>> df.withColumns($df.col("a").arr.gatherEvery({ step: 2 }).alias("ge"))
227
339
  * shape: (2, 2)
228
- * ┌──────────────┬────────┐
229
- * │ a │ ge │
230
- * ├──────────────┼────────┤
231
- * │ [1, 2, 3, 4] │ [1, 3] │
232
- * │ [5, 6, 7] │ [5, 7]
233
- * └──────────────┴────────┘
340
+ * ┌───────────┬────────┐
341
+ * │ a │ ge │
342
+ * ├───────────┼────────┤
343
+ * │ [1, 2, 3] │ [1, 3] │
344
+ * │ [4, 5] │ [4]
345
+ * └───────────┴────────┘
234
346
  */
235
- gather_every(options?: StepSliceArrayOptions): any;
347
+ gatherEvery(options?: StepSliceArrayOptions): any;
236
348
  /**
237
349
  * Extracts a single list element by its index position.
238
350
  * @param index The 0-based or negative index position to extract.
239
- * @param null_on_oob If true, returns null if index is out of bounds (default: true).
351
+ * @param nullOnOob If true, returns null if index is out of bounds (default: true).
240
352
  * @returns ColumnExpression
241
353
  * @example
242
- * >>> const df = $df.data({ a: [[10, 20], [30]] })
243
- * >>> df.with_columns($df.col("a").arr.get(1).alias("second"))
354
+ * >>> const df = $df.data({ a: [[1, 2, 3], [4, 5]] })
355
+ * >>> df
356
+ * shape: (2, 1)
357
+ * ┌───────────┐
358
+ * │ a │
359
+ * ├───────────┤
360
+ * │ [1, 2, 3] │
361
+ * │ [4, 5] │
362
+ * └───────────┘
363
+ * >>> df.withColumns($df.col("a").arr.get(1).alias("second"))
244
364
  * shape: (2, 2)
245
- * ┌──────────┬────────┐
246
- * │ a │ second │
247
- * ├──────────┼────────┤
248
- * │ [10, 20] │ 20
249
- * │ [30] null
250
- * └──────────┴────────┘
365
+ * ┌───────────┬────────┐
366
+ * │ a │ second │
367
+ * ├───────────┼────────┤
368
+ * │ [1, 2, 3] │ 2
369
+ * │ [4, 5] 5
370
+ * └───────────┴────────┘
251
371
  */
252
- get(index: number, null_on_oob?: boolean): any;
372
+ get(index: number, nullOnOob?: boolean): any;
253
373
  /**
254
374
  * Joins elements of list columns into a single string column.
255
375
  * @param separator The character sequence separating list elements.
256
376
  * @param options String conversion options.
257
377
  * @returns ColumnExpression
258
378
  * @example
259
- * >>> const df = $df.data({ a: [["a", "b"], ["c"]] })
260
- * >>> df.with_columns($df.col("a").arr.join("-").alias("joined"))
261
- * shape: (2, 2)
262
- * ┌──────────┬────────┐
263
- * │ a joined │
264
- * ├──────────┼────────┤
265
- * │ ["a","b"] "a-b"
266
- * │ ["c"] │ "c" │
267
- * └──────────┴────────┘
379
+ * >>> const df = $df.data({ a: [[1, 2, 3], [4, 5]] })
380
+ * >>> df
381
+ * shape: (2, 1)
382
+ * ┌───────────┐
383
+ * │ a
384
+ * ├───────────┤
385
+ * │ [1, 2, 3] │
386
+ * │ [4, 5] │
387
+ * └───────────┘
388
+ * >>> df.withColumns($df.col("a").arr.join("-").alias("joined"))
389
+ * shape: (2, 2)
390
+ * ┌────────────┬────────┐
391
+ * │ a │ joined │
392
+ * ├────────────┼────────┤
393
+ * │ ["a", "b"] │ "a-b" │
394
+ * │ ["c"] │ "c" │
395
+ * └────────────┴────────┘
268
396
  */
269
397
  join(separator?: string, options?: JoinArrayOptions): any;
270
398
  /**
271
399
  * Returns the last element of each list.
272
- * @param null_on_oob If true, returns null if the list is empty (default: true).
400
+ * @param nullOnOob If true, returns null if the list is empty (default: true).
273
401
  * @returns ColumnExpression
274
402
  * @example
275
- * >>> const df = $df.data({ a: [[10, 20], [30]] })
276
- * >>> df.with_columns($df.col("a").arr.last().alias("last_a"))
403
+ * >>> const df = $df.data({ a: [[1, 2, 3], [4, 5]] })
404
+ * >>> df
405
+ * shape: (2, 1)
406
+ * ┌───────────┐
407
+ * │ a │
408
+ * ├───────────┤
409
+ * │ [1, 2, 3] │
410
+ * │ [4, 5] │
411
+ * └───────────┘
412
+ * >>> df.withColumns($df.col("a").arr.last().alias("last_a"))
277
413
  * shape: (2, 2)
278
- * ┌──────────┬────────┐
279
- * │ a │ last_a │
280
- * ├──────────┼────────┤
281
- * │ [10, 20] │ 20
282
- * │ [30] 30
283
- * └──────────┴────────┐
414
+ * ┌───────────┬────────┐
415
+ * │ a │ last_a │
416
+ * ├───────────┼────────┤
417
+ * │ [1, 2, 3] │ 3
418
+ * │ [4, 5] 5
419
+ * └───────────┴────────┘
284
420
  */
285
- last(null_on_oob?: boolean): any;
421
+ last(nullOnOob?: boolean): any;
286
422
  /**
287
423
  * Returns the length of each list inside the column cell.
288
424
  */
@@ -291,29 +427,45 @@ export declare class ArrayExprNamespace {
291
427
  * Returns the length of each list inside the column cell.
292
428
  * @returns ColumnExpression
293
429
  * @example
294
- * >>> const df = $df.data({ a: [[10, 20], [30, 40, 50]] })
295
- * >>> df.with_columns($df.col("a").arr.lengths().alias("len_a"))
430
+ * >>> const df = $df.data({ a: [[1, 2, 3], [4, 5]] })
431
+ * >>> df
432
+ * shape: (2, 1)
433
+ * ┌───────────┐
434
+ * │ a │
435
+ * ├───────────┤
436
+ * │ [1, 2, 3] │
437
+ * │ [4, 5] │
438
+ * └───────────┘
439
+ * >>> df.withColumns($df.col("a").arr.lengths().alias("len_a"))
296
440
  * shape: (2, 2)
297
- * ┌──────────────┬───────┐
298
- * │ a │ len_a │
299
- * ├──────────────┼───────┤
300
- * │ [10, 20] 2
301
- * │ [30, 40, 50] 3
302
- * └──────────────┴───────┘
441
+ * ┌───────────┬───────┐
442
+ * │ a │ len_a │
443
+ * ├───────────┼───────┤
444
+ * │ [1, 2, 3] 3
445
+ * │ [4, 5] 2
446
+ * └───────────┴───────┘
303
447
  */
304
448
  lengths(): any;
305
449
  /**
306
450
  * Returns the maximum value of elements inside each list.
307
451
  * @returns ColumnExpression
308
452
  * @example
309
- * >>> const df = $df.data({ a: [[1, 5, 2], [10, 4]] })
310
- * >>> df.with_columns($df.col("a").arr.max().alias("max_a"))
453
+ * >>> const df = $df.data({ a: [[1, 2, 3], [4, 5]] })
454
+ * >>> df
455
+ * shape: (2, 1)
456
+ * ┌───────────┐
457
+ * │ a │
458
+ * ├───────────┤
459
+ * │ [1, 2, 3] │
460
+ * │ [4, 5] │
461
+ * └───────────┘
462
+ * >>> df.withColumns($df.col("a").arr.max().alias("max_a"))
311
463
  * shape: (2, 2)
312
464
  * ┌───────────┬───────┐
313
465
  * │ a │ max_a │
314
466
  * ├───────────┼───────┤
315
- * │ [1, 5, 2] │ 5
316
- * │ [10, 4] 10
467
+ * │ [1, 2, 3] │ 3
468
+ * │ [4, 5] 5
317
469
  * └───────────┴───────┘
318
470
  */
319
471
  max(): any;
@@ -321,14 +473,22 @@ export declare class ArrayExprNamespace {
321
473
  * Returns average of elements inside each list.
322
474
  * @returns ColumnExpression
323
475
  * @example
324
- * >>> const df = $df.data({ a: [[1, 5, 9], [10, 40]] })
325
- * >>> df.with_columns($df.col("a").arr.mean().alias("mean_a"))
476
+ * >>> const df = $df.data({ a: [[1, 2, 3], [4, 5]] })
477
+ * >>> df
478
+ * shape: (2, 1)
479
+ * ┌───────────┐
480
+ * │ a │
481
+ * ├───────────┤
482
+ * │ [1, 2, 3] │
483
+ * │ [4, 5] │
484
+ * └───────────┘
485
+ * >>> df.withColumns($df.col("a").arr.mean().alias("mean_a"))
326
486
  * shape: (2, 2)
327
487
  * ┌───────────┬────────┐
328
488
  * │ a │ mean_a │
329
489
  * ├───────────┼────────┤
330
- * │ [1, 5, 9] │ 5
331
- * │ [10, 40] 25
490
+ * │ [1, 2, 3] │ 2
491
+ * │ [4, 5] 4.5
332
492
  * └───────────┴────────┘
333
493
  */
334
494
  mean(): any;
@@ -336,29 +496,45 @@ export declare class ArrayExprNamespace {
336
496
  * Returns statistical median inside each list.
337
497
  * @returns ColumnExpression
338
498
  * @example
339
- * >>> const df = $df.data({ a: [[1, 3, 5, 7], [10, 20, 30]] })
340
- * >>> df.with_columns($df.col("a").arr.median().alias("med"))
341
- * shape: (2, 2)
342
- * ┌────────────────┬──────┐
343
- * │ a med │
344
- * ├────────────────┼──────┤
345
- * │ [1, 3, 5, 7] 4
346
- * │ [10, 20, 30] 20 │
347
- * └────────────────┴──────┘
499
+ * >>> const df = $df.data({ a: [[1, 2, 3], [4, 5]] })
500
+ * >>> df
501
+ * shape: (2, 1)
502
+ * ┌───────────┐
503
+ * │ a
504
+ * ├───────────┤
505
+ * │ [1, 2, 3] │
506
+ * │ [4, 5]
507
+ * └───────────┘
508
+ * >>> df.withColumns($df.col("a").arr.median().alias("med"))
509
+ * shape: (2, 2)
510
+ * ┌───────────┬──────┐
511
+ * │ a │ med │
512
+ * ├───────────┼──────┤
513
+ * │ [1, 2, 3] │ 2 │
514
+ * │ [4, 5] │ 4.5 │
515
+ * └───────────┴──────┘
348
516
  */
349
517
  median(): any;
350
518
  /**
351
519
  * Returns minimum of elements inside each list.
352
520
  * @returns ColumnExpression
353
521
  * @example
354
- * >>> const df = $df.data({ a: [[1, 5, 2], [10, 4]] })
355
- * >>> df.with_columns($df.col("a").arr.min().alias("min_a"))
522
+ * >>> const df = $df.data({ a: [[1, 2, 3], [4, 5]] })
523
+ * >>> df
524
+ * shape: (2, 1)
525
+ * ┌───────────┐
526
+ * │ a │
527
+ * ├───────────┤
528
+ * │ [1, 2, 3] │
529
+ * │ [4, 5] │
530
+ * └───────────┘
531
+ * >>> df.withColumns($df.col("a").arr.min().alias("min_a"))
356
532
  * shape: (2, 2)
357
533
  * ┌───────────┬───────┐
358
534
  * │ a │ min_a │
359
535
  * ├───────────┼───────┤
360
- * │ [1, 5, 2] │ 1 │
361
- * │ [10, 4] │ 4 │
536
+ * │ [1, 2, 3] │ 1 │
537
+ * │ [4, 5] │ 4 │
362
538
  * └───────────┴───────┘
363
539
  */
364
540
  min(): any;
@@ -366,15 +542,23 @@ export declare class ArrayExprNamespace {
366
542
  * Returns the mode value inside each list.
367
543
  * @returns ColumnExpression
368
544
  * @example
369
- * >>> const df = $df.data({ a: [[1, 2, 2, 3], [5, 5, 6]] })
370
- * >>> df.with_columns($df.col("a").arr.mode().alias("mode_a"))
545
+ * >>> const df = $df.data({ a: [[1, 2, 3], [4, 5]] })
546
+ * >>> df
547
+ * shape: (2, 1)
548
+ * ┌───────────┐
549
+ * │ a │
550
+ * ├───────────┤
551
+ * │ [1, 2, 3] │
552
+ * │ [4, 5] │
553
+ * └───────────┘
554
+ * >>> df.withColumns($df.col("a").arr.mode().alias("mode_a"))
371
555
  * shape: (2, 2)
372
- * ┌──────────────┬────────┐
373
- * │ a │ mode_a
374
- * ├──────────────┼────────┤
375
- * │ [1, 2, 2, 3] │ 2 │
376
- * │ [5, 5, 6] │ 5
377
- * └──────────────┴────────┘
556
+ * ┌───────────┬───────────┐
557
+ * │ a │ mode_a
558
+ * ├───────────┼───────────┤
559
+ * │ [1, 2, 3] │ [1, 2, 3] │
560
+ * │ [4, 5] │ [4, 5]
561
+ * └───────────┴───────────┘
378
562
  */
379
563
  mode(): any;
380
564
  /**
@@ -382,23 +566,39 @@ export declare class ArrayExprNamespace {
382
566
  * @param options Formatting/statistics parameters.
383
567
  * @returns ColumnExpression
384
568
  * @example
385
- * >>> const df = $df.data({ a: [[1, 2, 2, 3], [4, 5]] })
386
- * >>> df.with_columns($df.col("a").arr.n_unique().alias("unique_len"))
569
+ * >>> const df = $df.data({ a: [[1, 2, 3], [4, 5]] })
570
+ * >>> df
571
+ * shape: (2, 1)
572
+ * ┌───────────┐
573
+ * │ a │
574
+ * ├───────────┤
575
+ * │ [1, 2, 3] │
576
+ * │ [4, 5] │
577
+ * └───────────┘
578
+ * >>> df.withColumns($df.col("a").arr.nUnique().alias("unique_len"))
387
579
  * shape: (2, 2)
388
- * ┌──────────────┬────────────┐
389
- * │ a │ unique_len │
390
- * ├──────────────┼────────────┤
391
- * │ [1, 2, 2, 3] │ 3 │
392
- * │ [4, 5] │ 2 │
393
- * └──────────────┴────────────┘
580
+ * ┌───────────┬────────────┐
581
+ * │ a │ unique_len │
582
+ * ├───────────┼────────────┤
583
+ * │ [1, 2, 3] │ 3 │
584
+ * │ [4, 5] │ 2 │
585
+ * └───────────┴────────────┘
394
586
  */
395
- n_unique(options?: UniqueArrayStatsOptions): any;
587
+ nUnique(options?: UniqueArrayStatsOptions): any;
396
588
  /**
397
589
  * Reverses elements of list columns.
398
590
  * @returns ColumnExpression
399
591
  * @example
400
- * >>> const df = $df.data({ a: [[1, 2, 3], [4, 5]] })
401
- * >>> df.with_columns($df.col("a").arr.reverse().alias("reversed"))
592
+ * >>> const df = $df.data({ a: [[1, 2, 3], [4, 5]] })
593
+ * >>> df
594
+ * shape: (2, 1)
595
+ * ┌───────────┐
596
+ * │ a │
597
+ * ├───────────┤
598
+ * │ [1, 2, 3] │
599
+ * │ [4, 5] │
600
+ * └───────────┘
601
+ * >>> df.withColumns($df.col("a").arr.reverse().alias("reversed"))
402
602
  * shape: (2, 2)
403
603
  * ┌───────────┬───────────┐
404
604
  * │ a │ reversed │
@@ -413,8 +613,16 @@ export declare class ArrayExprNamespace {
413
613
  * @param n Positive or negative offsets shift amount (default: 1).
414
614
  * @returns ColumnExpression
415
615
  * @example
416
- * >>> const df = $df.data({ a: [[1, 2, 3], [4, 5]] })
417
- * >>> df.with_columns($df.col("a").arr.shift(1).alias("shifted"))
616
+ * >>> const df = $df.data({ a: [[1, 2, 3], [4, 5]] })
617
+ * >>> df
618
+ * shape: (2, 1)
619
+ * ┌───────────┐
620
+ * │ a │
621
+ * ├───────────┤
622
+ * │ [1, 2, 3] │
623
+ * │ [4, 5] │
624
+ * └───────────┘
625
+ * >>> df.withColumns($df.col("a").arr.shift(1).alias("shifted"))
418
626
  * shape: (2, 2)
419
627
  * ┌───────────┬──────────────────┐
420
628
  * │ a │ shifted │
@@ -430,15 +638,23 @@ export declare class ArrayExprNamespace {
430
638
  * @param end The slice ending index.
431
639
  * @returns ColumnExpression
432
640
  * @example
433
- * >>> const df = $df.data({ a: [[1, 2, 3, 4], [5, 6]] })
434
- * >>> df.with_columns($df.col("a").arr.slice(1, 3).alias("sliced"))
641
+ * >>> const df = $df.data({ a: [[1, 2, 3], [4, 5]] })
642
+ * >>> df
643
+ * shape: (2, 1)
644
+ * ┌───────────┐
645
+ * │ a │
646
+ * ├───────────┤
647
+ * │ [1, 2, 3] │
648
+ * │ [4, 5] │
649
+ * └───────────┘
650
+ * >>> df.withColumns($df.col("a").arr.slice(1, 3).alias("sliced"))
435
651
  * shape: (2, 2)
436
- * ┌──────────────┬────────┐
437
- * │ a │ sliced │
438
- * ├──────────────┼────────┤
439
- * │ [1, 2, 3, 4] │ [2, 3] │
440
- * │ [5, 6] │ [6] │
441
- * └──────────────┴────────┘
652
+ * ┌───────────┬────────┐
653
+ * │ a │ sliced │
654
+ * ├───────────┼────────┤
655
+ * │ [1, 2, 3] │ [2, 3] │
656
+ * │ [4, 5] │ [5] │
657
+ * └───────────┴────────┘
442
658
  */
443
659
  slice(start?: number, end?: number): any;
444
660
  /**
@@ -448,8 +664,16 @@ export declare class ArrayExprNamespace {
448
664
  * @param items The elements to insert.
449
665
  * @returns ColumnExpression
450
666
  * @example
451
- * >>> const df = $df.data({ a: [[1, 2, 3], [4, 5]] })
452
- * >>> df.with_columns($df.col("a").arr.splice(1, 1, 10, 20).alias("spliced"))
667
+ * >>> const df = $df.data({ a: [[1, 2, 3], [4, 5]] })
668
+ * >>> df
669
+ * shape: (2, 1)
670
+ * ┌───────────┐
671
+ * │ a │
672
+ * ├───────────┤
673
+ * │ [1, 2, 3] │
674
+ * │ [4, 5] │
675
+ * └───────────┘
676
+ * >>> df.withColumns($df.col("a").arr.splice(1, 1, 10, 20).alias("spliced"))
453
677
  * shape: (2, 2)
454
678
  * ┌───────────┬─────────────────┐
455
679
  * │ a │ spliced │
@@ -464,14 +688,22 @@ export declare class ArrayExprNamespace {
464
688
  * @param options Sort customization parameters (e.g. descending flag).
465
689
  * @returns ColumnExpression
466
690
  * @example
467
- * >>> const df = $df.data({ a: [[3, 1, 2], [5, 4]] })
468
- * >>> df.with_columns($df.col("a").arr.sort().alias("sorted"))
691
+ * >>> const df = $df.data({ a: [[1, 2, 3], [4, 5]] })
692
+ * >>> df
693
+ * shape: (2, 1)
694
+ * ┌───────────┐
695
+ * │ a │
696
+ * ├───────────┤
697
+ * │ [1, 2, 3] │
698
+ * │ [4, 5] │
699
+ * └───────────┘
700
+ * >>> df.withColumns($df.col("a").arr.sort().alias("sorted"))
469
701
  * shape: (2, 2)
470
702
  * ┌───────────┬───────────┐
471
703
  * │ a │ sorted │
472
704
  * ├───────────┼───────────┤
473
- * │ [3, 1, 2] │ [1, 2, 3] │
474
- * │ [5, 4] │ [4, 5] │
705
+ * │ [1, 2, 3] │ [1, 2, 3] │
706
+ * │ [4, 5] │ [4, 5] │
475
707
  * └───────────┴───────────┘
476
708
  */
477
709
  sort(options?: SortArrayOptions): any;
@@ -479,29 +711,45 @@ export declare class ArrayExprNamespace {
479
711
  * Returns sample standard deviation of elements inside each list.
480
712
  * @returns ColumnExpression
481
713
  * @example
482
- * >>> const df = $df.data({ a: [[1, 2, 3], [10, 20]] })
483
- * >>> df.with_columns($df.col("a").arr.std().alias("std_dev"))
484
- * shape: (2, 2)
485
- * ┌───────────┬─────────┐
486
- * │ a │ std_dev │
487
- * ├───────────┼─────────┤
488
- * │ [1, 2, 3] │ 1 │
489
- * │ [10, 20] 7.071 │
490
- * └───────────┴─────────┘
714
+ * >>> const df = $df.data({ a: [[1, 2, 3], [4, 5]] })
715
+ * >>> df
716
+ * shape: (2, 1)
717
+ * ┌───────────┐
718
+ * │ a │
719
+ * ├───────────┤
720
+ * │ [1, 2, 3] │
721
+ * │ [4, 5]
722
+ * └───────────┘
723
+ * >>> df.withColumns($df.col("a").arr.std().alias("std_dev"))
724
+ * shape: (2, 2)
725
+ * ┌───────────┬──────────┐
726
+ * │ a │ std_dev │
727
+ * ├───────────┼──────────┤
728
+ * │ [1, 2, 3] │ 1 │
729
+ * │ [4, 5] │ 0.707107 │
730
+ * └───────────┴──────────┘
491
731
  */
492
732
  std(): any;
493
733
  /**
494
734
  * Returns sum of elements inside each list.
495
735
  * @returns ColumnExpression
496
736
  * @example
497
- * >>> const df = $df.data({ a: [[1, 2, 3], [10, 20]] })
498
- * >>> df.with_columns($df.col("a").arr.sum().alias("sum_a"))
737
+ * >>> const df = $df.data({ a: [[1, 2, 3], [4, 5]] })
738
+ * >>> df
739
+ * shape: (2, 1)
740
+ * ┌───────────┐
741
+ * │ a │
742
+ * ├───────────┤
743
+ * │ [1, 2, 3] │
744
+ * │ [4, 5] │
745
+ * └───────────┘
746
+ * >>> df.withColumns($df.col("a").arr.sum().alias("sum_a"))
499
747
  * shape: (2, 2)
500
748
  * ┌───────────┬───────┐
501
749
  * │ a │ sum_a │
502
750
  * ├───────────┼───────┤
503
751
  * │ [1, 2, 3] │ 6 │
504
- * │ [10, 20] 30
752
+ * │ [4, 5] 9
505
753
  * └───────────┴───────┘
506
754
  */
507
755
  sum(): any;
@@ -510,8 +758,16 @@ export declare class ArrayExprNamespace {
510
758
  * @param options Config flags including custom field names or upper bound size.
511
759
  * @returns ColumnExpression
512
760
  * @example
513
- * >>> const df = $df.data({ a: [[1, 2], [3, 4]] })
514
- * >>> df.with_columns($df.col("a").arr.to_struct({ fields: ["x", "y"] }).alias("struct_a"))
761
+ * >>> const df = $df.data({ a: [[1, 2, 3], [4, 5]] })
762
+ * >>> df
763
+ * shape: (2, 1)
764
+ * ┌───────────┐
765
+ * │ a │
766
+ * ├───────────┤
767
+ * │ [1, 2, 3] │
768
+ * │ [4, 5] │
769
+ * └───────────┘
770
+ * >>> df.withColumns($df.col("a").arr.toStruct({ fields: ["x", "y"] }).alias("struct_a"))
515
771
  * shape: (2, 2)
516
772
  * ┌────────┬────────────────┐
517
773
  * │ a │ struct_a │
@@ -520,35 +776,51 @@ export declare class ArrayExprNamespace {
520
776
  * │ [3, 4] │ { x: 3, y: 4 } │
521
777
  * └────────┴────────────────┘
522
778
  */
523
- to_struct({ upper_bound, fields }?: ToStructOptions): any;
779
+ toStruct({ upperBound, fields }?: ToStructOptions): any;
524
780
  /**
525
781
  * Fills each list with unique elements only.
526
782
  * @param options Custom uniqueness matching configuration.
527
783
  * @returns ColumnExpression
528
784
  * @example
529
- * >>> const df = $df.data({ a: [[1, 2, 2, 3], [4, 4, 5]] })
530
- * >>> df.with_columns($df.col("a").arr.unique().alias("unique_a"))
785
+ * >>> const df = $df.data({ a: [[1, 2, 3], [4, 5]] })
786
+ * >>> df
787
+ * shape: (2, 1)
788
+ * ┌───────────┐
789
+ * │ a │
790
+ * ├───────────┤
791
+ * │ [1, 2, 3] │
792
+ * │ [4, 5] │
793
+ * └───────────┘
794
+ * >>> df.withColumns($df.col("a").arr.unique().alias("unique_a"))
531
795
  * shape: (2, 2)
532
- * ┌──────────────┬───────────┐
533
- * │ a │ unique_a │
534
- * ├──────────────┼───────────┤
535
- * │ [1, 2, 2, 3] │ [1, 2, 3] │
536
- * │ [4, 4, 5] │ [4, 5] │
537
- * └──────────────┴───────────┘
796
+ * ┌───────────┬───────────┐
797
+ * │ a │ unique_a │
798
+ * ├───────────┼───────────┤
799
+ * │ [1, 2, 3] │ [1, 2, 3] │
800
+ * │ [4, 5] │ [4, 5] │
801
+ * └───────────┴───────────┘
538
802
  */
539
803
  unique(options?: UniqueArrayStatsOptions): any;
540
804
  /**
541
805
  * Returns sample variance of elements inside each list.
542
806
  * @returns ColumnExpression
543
807
  * @example
544
- * >>> const df = $df.data({ a: [[1, 2, 3], [10, 20]] })
545
- * >>> df.with_columns($df.col("a").arr.variance().alias("var_a"))
808
+ * >>> const df = $df.data({ a: [[1, 2, 3], [4, 5]] })
809
+ * >>> df
810
+ * shape: (2, 1)
811
+ * ┌───────────┐
812
+ * │ a │
813
+ * ├───────────┤
814
+ * │ [1, 2, 3] │
815
+ * │ [4, 5] │
816
+ * └───────────┘
817
+ * >>> df.withColumns($df.col("a").arr.variance().alias("var_a"))
546
818
  * shape: (2, 2)
547
819
  * ┌───────────┬───────┐
548
820
  * │ a │ var_a │
549
821
  * ├───────────┼───────┤
550
822
  * │ [1, 2, 3] │ 1 │
551
- * │ [10, 20] 50
823
+ * │ [4, 5] 0.5
552
824
  * └───────────┴───────┘
553
825
  */
554
826
  variance(): any;
@@ -557,8 +829,16 @@ export declare class ArrayExprNamespace {
557
829
  * @param expr The sub-expression to evaluate inside each nested list.
558
830
  * @returns ColumnExpression
559
831
  * @example
560
- * >>> const df = $df.data({ a: [[1, 2], [3, 4]] })
561
- * >>> df.with_columns($df.col("a").arr.eval($df.element().mul(10)).alias("multiplied"))
832
+ * >>> const df = $df.data({ a: [[1, 2, 3], [4, 5]] })
833
+ * >>> df
834
+ * shape: (2, 1)
835
+ * ┌───────────┐
836
+ * │ a │
837
+ * ├───────────┤
838
+ * │ [1, 2, 3] │
839
+ * │ [4, 5] │
840
+ * └───────────┘
841
+ * >>> df.withColumns($df.col("a").arr.eval($df.element().mul(10)).alias("multiplied"))
562
842
  * shape: (2, 2)
563
843
  * ┌────────┬────────────┐
564
844
  * │ a │ multiplied │
@@ -577,7 +857,23 @@ export declare class ArrayExpr extends ExprBase {
577
857
  * @syntax $df.col(<column_name>).arr
578
858
  * @returns ArrayExprNamespace
579
859
  * @example
860
+ * >>> const df = $df.data({ a: [[1, 2, 3], [4, 5]] })
861
+ * >>> df
862
+ * shape: (2, 1)
863
+ * ┌───────────┐
864
+ * │ a │
865
+ * ├───────────┤
866
+ * │ [1, 2, 3] │
867
+ * │ [4, 5] │
868
+ * └───────────┘
580
869
  * >>> df.select($df.col("a").arr.len())
870
+ * shape: (2, 1)
871
+ * ┌─────┐
872
+ * │ len │
873
+ * ├─────┤
874
+ * │ 3 │
875
+ * │ 2 │
876
+ * └─────┘
581
877
  */
582
878
  get arr(): ArrayExprNamespace;
583
879
  }