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
@@ -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,12 +10,45 @@ 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;
14
+ /**
15
+ * Applies an aggregation expression or element-wise calculation over each array cell.
16
+ * @param expr Aggregation expression (e.g. $df.element().sum() or $df.element().max())
17
+ * @returns ColumnExpression
18
+ * @example
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"))
29
+ * shape: (2, 2)
30
+ * ┌───────────┬───────┐
31
+ * │ a │ sum_a │
32
+ * ├───────────┼───────┤
33
+ * │ [1, 2, 3] │ 6 │
34
+ * │ [4, 5] │ 9 │
35
+ * └───────────┴───────┘
36
+ */
37
+ agg(expr: IExpr): any;
13
38
  /**
14
39
  * Returns true if all items in nested list cells are truthy.
15
40
  * @returns ColumnExpression
16
41
  * @example
17
- * >>> const df = $df.data({ a: [[true, true], [true, false]] })
18
- * >>> 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"))
19
52
  * shape: (2, 2)
20
53
  * ┌───────────────┬──────────┐
21
54
  * │ a │ all_true │
@@ -29,24 +62,86 @@ export declare class ArrayExprNamespace {
29
62
  * Returns true if any item in nested list cells is truthy.
30
63
  * @returns ColumnExpression
31
64
  * @example
32
- * >>> const df = $df.data({ a: [[true, false], [false, false]] })
33
- * >>> 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"))
34
75
  * shape: (2, 2)
35
- * ┌────────────────┬──────────┐
36
- * │ a │ any_true │
37
- * ├────────────────┼──────────┤
38
- * │ [true, false] │ true │
39
- * │ [false, false] │ false
40
- * └────────────────┴──────────┘
76
+ * ┌───────────────┬──────────┐
77
+ * │ a │ any_true │
78
+ * ├───────────────┼──────────┤
79
+ * │ [true, true] │ true │
80
+ * │ [true, false] │ true
81
+ * └───────────────┴──────────┘
41
82
  */
42
83
  any(): any;
84
+ /**
85
+ * Finds the index of the maximum value in each array.
86
+ * @returns ColumnExpression
87
+ * @example
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"))
98
+ * shape: (2, 2)
99
+ * ┌───────────┬─────────┐
100
+ * │ a │ max_idx │
101
+ * ├───────────┼─────────┤
102
+ * │ [1, 2, 3] │ 2 │
103
+ * │ [4, 5] │ 1 │
104
+ * └───────────┴─────────┘
105
+ */
106
+ argMax(): any;
107
+ /**
108
+ * Finds the index of the minimum value in each array.
109
+ * @returns ColumnExpression
110
+ * @example
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"))
121
+ * shape: (2, 2)
122
+ * ┌───────────┬─────────┐
123
+ * │ a │ min_idx │
124
+ * ├───────────┼─────────┤
125
+ * │ [1, 2, 3] │ 0 │
126
+ * │ [4, 5] │ 0 │
127
+ * └───────────┴─────────┘
128
+ */
129
+ argMin(): any;
43
130
  /**
44
131
  * Checks if nested lists contain item.
45
132
  * @param item The element to search for.
46
133
  * @returns ColumnExpression
47
134
  * @example
48
- * >>> const df = $df.data({ a: [[1, 2, 3], [4, 5]] })
49
- * >>> 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"))
50
145
  * shape: (2, 2)
51
146
  * ┌───────────┬───────────┐
52
147
  * │ a │ has_three │
@@ -61,24 +156,40 @@ export declare class ArrayExprNamespace {
61
156
  * @param items Array of elements that must all be present.
62
157
  * @returns ColumnExpression
63
158
  * @example
64
- * >>> const df = $df.data({ a: [[1, 2, 3], [1, 5]] })
65
- * >>> 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"))
66
169
  * shape: (2, 2)
67
170
  * ┌───────────┬─────────┐
68
171
  * │ a │ has_all │
69
172
  * ├───────────┼─────────┤
70
173
  * │ [1, 2, 3] │ true │
71
- * │ [1, 5] │ false │
174
+ * │ [4, 5] │ false │
72
175
  * └───────────┴─────────┘
73
176
  */
74
- contains_all(items: ArrayLike<any>): any;
177
+ containsAll(items: ArrayLike<any>): any;
75
178
  /**
76
179
  * Checks if nested lists contain any element in items.
77
180
  * @param items Array of elements where at least one must be present.
78
181
  * @returns ColumnExpression
79
182
  * @example
80
- * >>> const df = $df.data({ a: [[1, 2], [3, 4]] })
81
- * >>> 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"))
82
193
  * shape: (2, 2)
83
194
  * ┌────────┬─────────┐
84
195
  * │ a │ has_any │
@@ -87,156 +198,227 @@ export declare class ArrayExprNamespace {
87
198
  * │ [3, 4] │ true │
88
199
  * └────────┴─────────┘
89
200
  */
90
- contains_any(items: ArrayLike<any>): any;
201
+ containsAny(items: ArrayLike<any>): any;
91
202
  /**
92
203
  * Counts occurrence frequency of item inside nested lists.
93
204
  * @param item The value to count occurrences of.
94
205
  * @param options Statistics and matching options.
95
206
  * @returns ColumnExpression
96
207
  * @example
97
- * >>> const df = $df.data({ a: [[1, 2, 2, 3], [4, 5]] })
98
- * >>> 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"))
99
218
  * shape: (2, 2)
100
- * ┌──────────────┬──────┐
101
- * │ a │ twos │
102
- * ├──────────────┼──────┤
103
- * │ [1, 2, 2, 3] │ 2
104
- * │ [4, 5] │ 0 │
105
- * └──────────────┴──────┘
219
+ * ┌───────────┬──────┐
220
+ * │ a │ twos │
221
+ * ├───────────┼──────┤
222
+ * │ [1, 2, 3] │ 1
223
+ * │ [4, 5] │ 0 │
224
+ * └───────────┴──────┘
106
225
  */
107
- count_matches(item: any, options?: UniqueArrayStatsOptions): any;
226
+ countMatches(item: any, options?: UniqueArrayStatsOptions): any;
108
227
  /**
109
228
  * Filters elements of list columns matching a boolean sub-expression.
110
229
  * @param expr The boolean column expression to filter by.
111
230
  * @returns ColumnExpression
112
231
  * @example
113
- * >>> const df = $df.data({ a: [[1, 5, 10], [2, 8]] })
114
- * >>> df.with_columns($df.col("a").arr.filter($df.element().gt(4)).alias("filtered"))
115
- * shape: (2, 2)
116
- * ┌────────────┬──────────┐
117
- * │ a filtered │
118
- * ├────────────┼──────────┤
119
- * │ [1, 5, 10] │ [5, 10] │
120
- * │ [2, 8] [8] │
121
- * └────────────┴──────────┘
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
+ * └───────────┴──────────┘
122
249
  */
123
250
  filter(expr: IExpr): any;
124
251
  /**
125
- * Expands lists into row-wise records.
252
+ * Expands lists into row-wise elements and produces an index mapping for DataFrame unnesting.
126
253
  * @param options Config options including handling of empty arrays and nulls.
127
254
  * @returns ColumnExpression
128
255
  * @example
129
- * >>> const df = $df.data({ a: [[1, 2], [3]] })
130
- * >>> df.explode($df.col("a").arr.explode())
131
- * shape: (3, 1)
132
- * ┌───┐
133
- * │ a
134
- * ├───┤
135
- * │ 1 │
136
- * │ 2
137
- * │ 3 │
138
- * └───┘
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
+ * └───────┴────────┘
139
273
  */
140
- explode({ empty_as_null, keep_nulls }?: ExplodeOptions): any;
274
+ explode({ emptyAsNull, keepNulls }?: ExplodeOptions): any;
141
275
  /**
142
276
  * Returns the first element of each list.
143
- * @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).
144
278
  * @returns ColumnExpression
145
279
  * @example
146
- * >>> const df = $df.data({ a: [[10, 20], [30]] })
147
- * >>> 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"))
148
290
  * shape: (2, 2)
149
- * ┌──────────┬─────────┐
150
- * │ a │ first_a │
151
- * ├──────────┼─────────┤
152
- * │ [10, 20] │ 10
153
- * │ [30] 30
154
- * └──────────┴─────────┘
291
+ * ┌───────────┬─────────┐
292
+ * │ a │ first_a │
293
+ * ├───────────┼─────────┤
294
+ * │ [1, 2, 3] │ 1
295
+ * │ [4, 5] 4
296
+ * └───────────┴─────────┘
155
297
  */
156
- first(null_on_oob?: boolean): any;
298
+ first(nullOnOob?: boolean): any;
157
299
  /**
158
300
  * Gathers specific indices from each nested list.
159
301
  * @param indices Index or array of indices to extract.
160
- * @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).
161
303
  * @returns ColumnExpression
162
304
  * @example
163
- * >>> const df = $df.data({ a: [[10, 20, 30], [40, 50]] })
164
- * >>> 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"))
165
315
  * shape: (2, 2)
166
- * ┌──────────────┬──────────┐
167
- * │ a │ g │
168
- * ├──────────────┼──────────┤
169
- * │ [10, 20, 30] │ [10, 30]
170
- * │ [40, 50] │ [40, null]│
171
- * └──────────────┴──────────┘
316
+ * ┌───────────┬──────────┐
317
+ * │ a │ g │
318
+ * ├───────────┼──────────┤
319
+ * │ [1, 2, 3] │ [1, 3]
320
+ * │ [4, 5] │ [4, null]│
321
+ * └───────────┴──────────┘
172
322
  */
173
- gather(indices: number | ArrayLike<number>, null_on_oob?: boolean): any;
323
+ gather(indices: number | ArrayLike<number>, nullOnOob?: boolean): any;
174
324
  /**
175
325
  * Gather element slices with custom steps.
176
326
  * @param options Config options including offset, limit, and step size.
177
327
  * @returns ColumnExpression
178
328
  * @example
179
- * >>> const df = $df.data({ a: [[1, 2, 3, 4], [5, 6, 7]] })
180
- * >>> 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"))
181
339
  * shape: (2, 2)
182
- * ┌──────────────┬────────┐
183
- * │ a │ ge │
184
- * ├──────────────┼────────┤
185
- * │ [1, 2, 3, 4] │ [1, 3] │
186
- * │ [5, 6, 7] │ [5, 7]
187
- * └──────────────┴────────┘
340
+ * ┌───────────┬────────┐
341
+ * │ a │ ge │
342
+ * ├───────────┼────────┤
343
+ * │ [1, 2, 3] │ [1, 3] │
344
+ * │ [4, 5] │ [4]
345
+ * └───────────┴────────┘
188
346
  */
189
- gather_every(options?: StepSliceArrayOptions): any;
347
+ gatherEvery(options?: StepSliceArrayOptions): any;
190
348
  /**
191
349
  * Extracts a single list element by its index position.
192
350
  * @param index The 0-based or negative index position to extract.
193
- * @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).
194
352
  * @returns ColumnExpression
195
353
  * @example
196
- * >>> const df = $df.data({ a: [[10, 20], [30]] })
197
- * >>> 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"))
198
364
  * shape: (2, 2)
199
- * ┌──────────┬────────┐
200
- * │ a │ second │
201
- * ├──────────┼────────┤
202
- * │ [10, 20] │ 20
203
- * │ [30] null
204
- * └──────────┴────────┘
365
+ * ┌───────────┬────────┐
366
+ * │ a │ second │
367
+ * ├───────────┼────────┤
368
+ * │ [1, 2, 3] │ 2
369
+ * │ [4, 5] 5
370
+ * └───────────┴────────┘
205
371
  */
206
- get(index: number, null_on_oob?: boolean): any;
372
+ get(index: number, nullOnOob?: boolean): any;
207
373
  /**
208
374
  * Joins elements of list columns into a single string column.
209
375
  * @param separator The character sequence separating list elements.
210
376
  * @param options String conversion options.
211
377
  * @returns ColumnExpression
212
378
  * @example
213
- * >>> const df = $df.data({ a: [["a", "b"], ["c"]] })
214
- * >>> df.with_columns($df.col("a").arr.join("-").alias("joined"))
215
- * shape: (2, 2)
216
- * ┌──────────┬────────┐
217
- * │ a joined │
218
- * ├──────────┼────────┤
219
- * │ ["a","b"] "a-b"
220
- * │ ["c"] │ "c" │
221
- * └──────────┴────────┘
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
+ * └────────────┴────────┘
222
396
  */
223
397
  join(separator?: string, options?: JoinArrayOptions): any;
224
398
  /**
225
399
  * Returns the last element of each list.
226
- * @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).
227
401
  * @returns ColumnExpression
228
402
  * @example
229
- * >>> const df = $df.data({ a: [[10, 20], [30]] })
230
- * >>> 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"))
231
413
  * shape: (2, 2)
232
- * ┌──────────┬────────┐
233
- * │ a │ last_a │
234
- * ├──────────┼────────┤
235
- * │ [10, 20] │ 20
236
- * │ [30] 30
237
- * └──────────┴────────┐
414
+ * ┌───────────┬────────┐
415
+ * │ a │ last_a │
416
+ * ├───────────┼────────┤
417
+ * │ [1, 2, 3] │ 3
418
+ * │ [4, 5] 5
419
+ * └───────────┴────────┘
238
420
  */
239
- last(null_on_oob?: boolean): any;
421
+ last(nullOnOob?: boolean): any;
240
422
  /**
241
423
  * Returns the length of each list inside the column cell.
242
424
  */
@@ -245,59 +427,68 @@ export declare class ArrayExprNamespace {
245
427
  * Returns the length of each list inside the column cell.
246
428
  * @returns ColumnExpression
247
429
  * @example
248
- * >>> const df = $df.data({ a: [[10, 20], [30, 40, 50]] })
249
- * >>> 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"))
250
440
  * shape: (2, 2)
251
- * ┌──────────────┬───────┐
252
- * │ a │ len_a │
253
- * ├──────────────┼───────┤
254
- * │ [10, 20] 2
255
- * │ [30, 40, 50] 3
256
- * └──────────────┴───────┘
441
+ * ┌───────────┬───────┐
442
+ * │ a │ len_a │
443
+ * ├───────────┼───────┤
444
+ * │ [1, 2, 3] 3
445
+ * │ [4, 5] 2
446
+ * └───────────┴───────┘
257
447
  */
258
448
  lengths(): any;
259
449
  /**
260
450
  * Returns the maximum value of elements inside each list.
261
451
  * @returns ColumnExpression
262
452
  * @example
263
- * >>> const df = $df.data({ a: [[1, 5, 2], [10, 4]] })
264
- * >>> 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"))
265
463
  * shape: (2, 2)
266
464
  * ┌───────────┬───────┐
267
465
  * │ a │ max_a │
268
466
  * ├───────────┼───────┤
269
- * │ [1, 5, 2] │ 5
270
- * │ [10, 4] 10
467
+ * │ [1, 2, 3] │ 3
468
+ * │ [4, 5] 5
271
469
  * └───────────┴───────┘
272
470
  */
273
471
  max(): any;
274
- /**
275
- * Returns the index of maximum value.
276
- * @returns ColumnExpression
277
- * @example
278
- * >>> const df = $df.data({ a: [[1, 5, 2], [10, 4]] })
279
- * >>> df.with_columns($df.col("a").arr.max_index().alias("max_idx"))
280
- * shape: (2, 2)
281
- * ┌───────────┬─────────┐
282
- * │ a │ max_idx │
283
- * ├───────────┼─────────┤
284
- * │ [1, 5, 2] │ 1 │
285
- * │ [10, 4] │ 0 │
286
- * └───────────┴─────────┘
287
- */
288
- max_index(): any;
289
472
  /**
290
473
  * Returns average of elements inside each list.
291
474
  * @returns ColumnExpression
292
475
  * @example
293
- * >>> const df = $df.data({ a: [[1, 5, 9], [10, 40]] })
294
- * >>> 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"))
295
486
  * shape: (2, 2)
296
487
  * ┌───────────┬────────┐
297
488
  * │ a │ mean_a │
298
489
  * ├───────────┼────────┤
299
- * │ [1, 5, 9] │ 5
300
- * │ [10, 40] 25
490
+ * │ [1, 2, 3] │ 2
491
+ * │ [4, 5] 4.5
301
492
  * └───────────┴────────┘
302
493
  */
303
494
  mean(): any;
@@ -305,60 +496,69 @@ export declare class ArrayExprNamespace {
305
496
  * Returns statistical median inside each list.
306
497
  * @returns ColumnExpression
307
498
  * @example
308
- * >>> const df = $df.data({ a: [[1, 3, 5, 7], [10, 20, 30]] })
309
- * >>> df.with_columns($df.col("a").arr.median().alias("med"))
310
- * shape: (2, 2)
311
- * ┌────────────────┬──────┐
312
- * │ a med │
313
- * ├────────────────┼──────┤
314
- * │ [1, 3, 5, 7] 4
315
- * │ [10, 20, 30] 20 │
316
- * └────────────────┴──────┘
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
+ * └───────────┴──────┘
317
516
  */
318
517
  median(): any;
319
518
  /**
320
519
  * Returns minimum of elements inside each list.
321
520
  * @returns ColumnExpression
322
521
  * @example
323
- * >>> const df = $df.data({ a: [[1, 5, 2], [10, 4]] })
324
- * >>> 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"))
325
532
  * shape: (2, 2)
326
533
  * ┌───────────┬───────┐
327
534
  * │ a │ min_a │
328
535
  * ├───────────┼───────┤
329
- * │ [1, 5, 2] │ 1 │
330
- * │ [10, 4] │ 4 │
536
+ * │ [1, 2, 3] │ 1 │
537
+ * │ [4, 5] │ 4 │
331
538
  * └───────────┴───────┘
332
539
  */
333
540
  min(): any;
334
- /**
335
- * Returns the index of minimum value.
336
- * @returns ColumnExpression
337
- * @example
338
- * >>> const df = $df.data({ a: [[5, 1, 2], [10, 4]] })
339
- * >>> df.with_columns($df.col("a").arr.min_index().alias("min_idx"))
340
- * shape: (2, 2)
341
- * ┌───────────┬─────────┐
342
- * │ a │ min_idx │
343
- * ├───────────┼─────────┤
344
- * │ [5, 1, 2] │ 1 │
345
- * │ [10, 4] │ 1 │
346
- * └───────────┴─────────┘
347
- */
348
- min_index(): any;
349
541
  /**
350
542
  * Returns the mode value inside each list.
351
543
  * @returns ColumnExpression
352
544
  * @example
353
- * >>> const df = $df.data({ a: [[1, 2, 2, 3], [5, 5, 6]] })
354
- * >>> 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"))
355
555
  * shape: (2, 2)
356
- * ┌──────────────┬────────┐
357
- * │ a │ mode_a
358
- * ├──────────────┼────────┤
359
- * │ [1, 2, 2, 3] │ 2 │
360
- * │ [5, 5, 6] │ 5
361
- * └──────────────┴────────┘
556
+ * ┌───────────┬───────────┐
557
+ * │ a │ mode_a
558
+ * ├───────────┼───────────┤
559
+ * │ [1, 2, 3] │ [1, 2, 3] │
560
+ * │ [4, 5] │ [4, 5]
561
+ * └───────────┴───────────┘
362
562
  */
363
563
  mode(): any;
364
564
  /**
@@ -366,23 +566,39 @@ export declare class ArrayExprNamespace {
366
566
  * @param options Formatting/statistics parameters.
367
567
  * @returns ColumnExpression
368
568
  * @example
369
- * >>> const df = $df.data({ a: [[1, 2, 2, 3], [4, 5]] })
370
- * >>> 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"))
371
579
  * shape: (2, 2)
372
- * ┌──────────────┬────────────┐
373
- * │ a │ unique_len │
374
- * ├──────────────┼────────────┤
375
- * │ [1, 2, 2, 3] │ 3 │
376
- * │ [4, 5] │ 2 │
377
- * └──────────────┴────────────┘
580
+ * ┌───────────┬────────────┐
581
+ * │ a │ unique_len │
582
+ * ├───────────┼────────────┤
583
+ * │ [1, 2, 3] │ 3 │
584
+ * │ [4, 5] │ 2 │
585
+ * └───────────┴────────────┘
378
586
  */
379
- n_unique(options?: UniqueArrayStatsOptions): any;
587
+ nUnique(options?: UniqueArrayStatsOptions): any;
380
588
  /**
381
589
  * Reverses elements of list columns.
382
590
  * @returns ColumnExpression
383
591
  * @example
384
- * >>> const df = $df.data({ a: [[1, 2, 3], [4, 5]] })
385
- * >>> 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"))
386
602
  * shape: (2, 2)
387
603
  * ┌───────────┬───────────┐
388
604
  * │ a │ reversed │
@@ -397,8 +613,16 @@ export declare class ArrayExprNamespace {
397
613
  * @param n Positive or negative offsets shift amount (default: 1).
398
614
  * @returns ColumnExpression
399
615
  * @example
400
- * >>> const df = $df.data({ a: [[1, 2, 3], [4, 5]] })
401
- * >>> 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"))
402
626
  * shape: (2, 2)
403
627
  * ┌───────────┬──────────────────┐
404
628
  * │ a │ shifted │
@@ -414,15 +638,23 @@ export declare class ArrayExprNamespace {
414
638
  * @param end The slice ending index.
415
639
  * @returns ColumnExpression
416
640
  * @example
417
- * >>> const df = $df.data({ a: [[1, 2, 3, 4], [5, 6]] })
418
- * >>> 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"))
419
651
  * shape: (2, 2)
420
- * ┌──────────────┬────────┐
421
- * │ a │ sliced │
422
- * ├──────────────┼────────┤
423
- * │ [1, 2, 3, 4] │ [2, 3] │
424
- * │ [5, 6] │ [6] │
425
- * └──────────────┴────────┘
652
+ * ┌───────────┬────────┐
653
+ * │ a │ sliced │
654
+ * ├───────────┼────────┤
655
+ * │ [1, 2, 3] │ [2, 3] │
656
+ * │ [4, 5] │ [5] │
657
+ * └───────────┴────────┘
426
658
  */
427
659
  slice(start?: number, end?: number): any;
428
660
  /**
@@ -432,8 +664,16 @@ export declare class ArrayExprNamespace {
432
664
  * @param items The elements to insert.
433
665
  * @returns ColumnExpression
434
666
  * @example
435
- * >>> const df = $df.data({ a: [[1, 2, 3], [4, 5]] })
436
- * >>> 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"))
437
677
  * shape: (2, 2)
438
678
  * ┌───────────┬─────────────────┐
439
679
  * │ a │ spliced │
@@ -448,14 +688,22 @@ export declare class ArrayExprNamespace {
448
688
  * @param options Sort customization parameters (e.g. descending flag).
449
689
  * @returns ColumnExpression
450
690
  * @example
451
- * >>> const df = $df.data({ a: [[3, 1, 2], [5, 4]] })
452
- * >>> 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"))
453
701
  * shape: (2, 2)
454
702
  * ┌───────────┬───────────┐
455
703
  * │ a │ sorted │
456
704
  * ├───────────┼───────────┤
457
- * │ [3, 1, 2] │ [1, 2, 3] │
458
- * │ [5, 4] │ [4, 5] │
705
+ * │ [1, 2, 3] │ [1, 2, 3] │
706
+ * │ [4, 5] │ [4, 5] │
459
707
  * └───────────┴───────────┘
460
708
  */
461
709
  sort(options?: SortArrayOptions): any;
@@ -463,29 +711,45 @@ export declare class ArrayExprNamespace {
463
711
  * Returns sample standard deviation of elements inside each list.
464
712
  * @returns ColumnExpression
465
713
  * @example
466
- * >>> const df = $df.data({ a: [[1, 2, 3], [10, 20]] })
467
- * >>> df.with_columns($df.col("a").arr.std().alias("std_dev"))
468
- * shape: (2, 2)
469
- * ┌───────────┬─────────┐
470
- * │ a │ std_dev │
471
- * ├───────────┼─────────┤
472
- * │ [1, 2, 3] │ 1 │
473
- * │ [10, 20] 7.071 │
474
- * └───────────┴─────────┘
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
+ * └───────────┴──────────┘
475
731
  */
476
732
  std(): any;
477
733
  /**
478
734
  * Returns sum of elements inside each list.
479
735
  * @returns ColumnExpression
480
736
  * @example
481
- * >>> const df = $df.data({ a: [[1, 2, 3], [10, 20]] })
482
- * >>> 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"))
483
747
  * shape: (2, 2)
484
748
  * ┌───────────┬───────┐
485
749
  * │ a │ sum_a │
486
750
  * ├───────────┼───────┤
487
751
  * │ [1, 2, 3] │ 6 │
488
- * │ [10, 20] 30
752
+ * │ [4, 5] 9
489
753
  * └───────────┴───────┘
490
754
  */
491
755
  sum(): any;
@@ -494,8 +758,16 @@ export declare class ArrayExprNamespace {
494
758
  * @param options Config flags including custom field names or upper bound size.
495
759
  * @returns ColumnExpression
496
760
  * @example
497
- * >>> const df = $df.data({ a: [[1, 2], [3, 4]] })
498
- * >>> 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"))
499
771
  * shape: (2, 2)
500
772
  * ┌────────┬────────────────┐
501
773
  * │ a │ struct_a │
@@ -504,35 +776,51 @@ export declare class ArrayExprNamespace {
504
776
  * │ [3, 4] │ { x: 3, y: 4 } │
505
777
  * └────────┴────────────────┘
506
778
  */
507
- to_struct({ upper_bound, fields }?: ToStructOptions): any;
779
+ toStruct({ upperBound, fields }?: ToStructOptions): any;
508
780
  /**
509
781
  * Fills each list with unique elements only.
510
782
  * @param options Custom uniqueness matching configuration.
511
783
  * @returns ColumnExpression
512
784
  * @example
513
- * >>> const df = $df.data({ a: [[1, 2, 2, 3], [4, 4, 5]] })
514
- * >>> 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"))
515
795
  * shape: (2, 2)
516
- * ┌──────────────┬───────────┐
517
- * │ a │ unique_a │
518
- * ├──────────────┼───────────┤
519
- * │ [1, 2, 2, 3] │ [1, 2, 3] │
520
- * │ [4, 4, 5] │ [4, 5] │
521
- * └──────────────┴───────────┘
796
+ * ┌───────────┬───────────┐
797
+ * │ a │ unique_a │
798
+ * ├───────────┼───────────┤
799
+ * │ [1, 2, 3] │ [1, 2, 3] │
800
+ * │ [4, 5] │ [4, 5] │
801
+ * └───────────┴───────────┘
522
802
  */
523
803
  unique(options?: UniqueArrayStatsOptions): any;
524
804
  /**
525
805
  * Returns sample variance of elements inside each list.
526
806
  * @returns ColumnExpression
527
807
  * @example
528
- * >>> const df = $df.data({ a: [[1, 2, 3], [10, 20]] })
529
- * >>> 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"))
530
818
  * shape: (2, 2)
531
819
  * ┌───────────┬───────┐
532
820
  * │ a │ var_a │
533
821
  * ├───────────┼───────┤
534
822
  * │ [1, 2, 3] │ 1 │
535
- * │ [10, 20] 50
823
+ * │ [4, 5] 0.5
536
824
  * └───────────┴───────┘
537
825
  */
538
826
  variance(): any;
@@ -541,8 +829,16 @@ export declare class ArrayExprNamespace {
541
829
  * @param expr The sub-expression to evaluate inside each nested list.
542
830
  * @returns ColumnExpression
543
831
  * @example
544
- * >>> const df = $df.data({ a: [[1, 2], [3, 4]] })
545
- * >>> 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"))
546
842
  * shape: (2, 2)
547
843
  * ┌────────┬────────────┐
548
844
  * │ a │ multiplied │
@@ -561,7 +857,23 @@ export declare class ArrayExpr extends ExprBase {
561
857
  * @syntax $df.col(<column_name>).arr
562
858
  * @returns ArrayExprNamespace
563
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
+ * └───────────┘
564
869
  * >>> df.select($df.col("a").arr.len())
870
+ * shape: (2, 1)
871
+ * ┌─────┐
872
+ * │ len │
873
+ * ├─────┤
874
+ * │ 3 │
875
+ * │ 2 │
876
+ * └─────┘
565
877
  */
566
878
  get arr(): ArrayExprNamespace;
567
879
  }