df-script 1.5.0 → 1.7.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 (159) hide show
  1. package/README.md +125 -9
  2. package/dist/api.d.ts +3 -2
  3. package/dist/assets/index-DBhGK6Tp.css +1 -0
  4. package/dist/assets/index-DEJEV_tU.js +195 -0
  5. package/dist/columnExpressions/ColumnExpr.d.ts +14 -7
  6. package/dist/columnExpressions/ExprBase.d.ts +26 -12
  7. package/dist/columnExpressions/constants.d.ts +1 -0
  8. package/dist/columnExpressions/functions/all.d.ts +23 -0
  9. package/dist/columnExpressions/functions/coalesce.d.ts +31 -2
  10. package/dist/columnExpressions/functions/element.d.ts +26 -1
  11. package/dist/columnExpressions/functions/exclude.d.ts +24 -0
  12. package/dist/columnExpressions/functions/implode.d.ts +28 -0
  13. package/dist/columnExpressions/functions/lit.d.ts +27 -0
  14. package/dist/columnExpressions/functions/seq_range.d.ts +36 -0
  15. package/dist/columnExpressions/functions/struct.d.ts +31 -0
  16. package/dist/columnExpressions/functions/when.d.ts +38 -8
  17. package/dist/columnExpressions/index.d.ts +2 -1
  18. package/dist/columnExpressions/mixins/AggregationExpr.d.ts +336 -2
  19. package/dist/columnExpressions/mixins/ArithmeticExpr.d.ts +620 -10
  20. package/dist/columnExpressions/mixins/ArrayExpr.d.ts +567 -0
  21. package/dist/columnExpressions/mixins/ComparisonExpr.d.ts +353 -0
  22. package/dist/columnExpressions/mixins/LogicalExpr.d.ts +82 -0
  23. package/dist/columnExpressions/mixins/ManipulationExpr.d.ts +40 -0
  24. package/dist/columnExpressions/mixins/StringExpr.d.ts +658 -5
  25. package/dist/columnExpressions/mixins/StructExpr.d.ts +70 -0
  26. package/dist/columnExpressions/mixins/TemporalExpr.d.ts +530 -4
  27. package/dist/columnExpressions/mixins/WindowExpr.d.ts +313 -2
  28. package/dist/columnExpressions/types.d.ts +2 -0
  29. package/dist/constants.d.ts +11 -0
  30. package/dist/dataframe/dataframe.d.ts +933 -3
  31. package/dist/dataframe/grouped/grouped.d.ts +41 -6
  32. package/dist/dataframe/types.d.ts +1 -0
  33. package/dist/dataframe/utils.d.ts +1 -0
  34. package/dist/datatypes/index.d.ts +3 -2
  35. package/dist/datatypes/types.d.ts +52 -7
  36. package/dist/exceptions/index.d.ts +23 -0
  37. package/dist/functions/concat.d.ts +50 -0
  38. package/dist/functions/read_csv.d.ts +9 -0
  39. package/dist/functions/read_json.d.ts +7 -2
  40. package/dist/index.html +17 -0
  41. package/dist/index.js +6 -6
  42. package/dist/index.mjs +6 -0
  43. package/dist/types.d.ts +51 -16
  44. package/dist/utils/{list.d.ts → array.d.ts} +68 -15
  45. package/dist/utils/binary.d.ts +3 -0
  46. package/dist/utils/csv.d.ts +1 -0
  47. package/dist/utils/date.d.ts +23 -54
  48. package/dist/utils/index.d.ts +3 -2
  49. package/dist/utils/json.d.ts +1 -0
  50. package/dist/utils/number.d.ts +15 -29
  51. package/dist/utils/object.d.ts +27 -0
  52. package/dist/utils/string.d.ts +15 -5
  53. package/package.json +18 -4
  54. package/dist/api.js +0 -26
  55. package/dist/bundle.min.js +0 -1
  56. package/dist/columnExpressions/ColumnExpr.js +0 -219
  57. package/dist/columnExpressions/ExprBase.js +0 -92
  58. package/dist/columnExpressions/constants.js +0 -7
  59. package/dist/columnExpressions/functions/all.js +0 -11
  60. package/dist/columnExpressions/functions/coalesce.js +0 -44
  61. package/dist/columnExpressions/functions/element.js +0 -11
  62. package/dist/columnExpressions/functions/exclude.js +0 -13
  63. package/dist/columnExpressions/functions/implode.js +0 -7
  64. package/dist/columnExpressions/functions/lit.js +0 -17
  65. package/dist/columnExpressions/functions/repeat.d.ts +0 -47
  66. package/dist/columnExpressions/functions/repeat.js +0 -131
  67. package/dist/columnExpressions/functions/seq_range.js +0 -91
  68. package/dist/columnExpressions/functions/when.js +0 -85
  69. package/dist/columnExpressions/index.js +0 -38
  70. package/dist/columnExpressions/mixins/AggregationExpr.js +0 -76
  71. package/dist/columnExpressions/mixins/ArithmeticExpr.js +0 -131
  72. package/dist/columnExpressions/mixins/BooleanExpr.d.ts +0 -40
  73. package/dist/columnExpressions/mixins/BooleanExpr.js +0 -67
  74. package/dist/columnExpressions/mixins/ComparisonExpr.js +0 -250
  75. package/dist/columnExpressions/mixins/ListExpr.d.ts +0 -39
  76. package/dist/columnExpressions/mixins/ListExpr.js +0 -224
  77. package/dist/columnExpressions/mixins/LogicalExpr.js +0 -53
  78. package/dist/columnExpressions/mixins/ManipulationExpr.js +0 -71
  79. package/dist/columnExpressions/mixins/NumericExpr.d.ts +0 -92
  80. package/dist/columnExpressions/mixins/NumericExpr.js +0 -259
  81. package/dist/columnExpressions/mixins/StringExpr.js +0 -237
  82. package/dist/columnExpressions/mixins/StructExpr.js +0 -139
  83. package/dist/columnExpressions/mixins/TemporalExpr.js +0 -126
  84. package/dist/columnExpressions/mixins/WindowExpr.js +0 -151
  85. package/dist/columnExpressions/types.js +0 -2
  86. package/dist/columnExpressions/utils.js +0 -45
  87. package/dist/dataframe/constants.js +0 -7
  88. package/dist/dataframe/dataframe.js +0 -990
  89. package/dist/dataframe/grouped/grouped.js +0 -114
  90. package/dist/dataframe/index.js +0 -20
  91. package/dist/dataframe/types.js +0 -2
  92. package/dist/dataframe/utils.js +0 -307
  93. package/dist/datatypes/DataType.js +0 -76
  94. package/dist/datatypes/index.js +0 -46
  95. package/dist/datatypes/types/Binary.d.ts +0 -9
  96. package/dist/datatypes/types/Binary.js +0 -18
  97. package/dist/datatypes/types/Boolean.d.ts +0 -9
  98. package/dist/datatypes/types/Boolean.js +0 -19
  99. package/dist/datatypes/types/Date.d.ts +0 -8
  100. package/dist/datatypes/types/Date.js +0 -21
  101. package/dist/datatypes/types/Datetime.d.ts +0 -8
  102. package/dist/datatypes/types/Datetime.js +0 -17
  103. package/dist/datatypes/types/Decimal.d.ts +0 -10
  104. package/dist/datatypes/types/Decimal.js +0 -28
  105. package/dist/datatypes/types/Duration.d.ts +0 -8
  106. package/dist/datatypes/types/Duration.js +0 -17
  107. package/dist/datatypes/types/Float32.d.ts +0 -8
  108. package/dist/datatypes/types/Float32.js +0 -17
  109. package/dist/datatypes/types/Float64.d.ts +0 -8
  110. package/dist/datatypes/types/Float64.js +0 -17
  111. package/dist/datatypes/types/Int16.d.ts +0 -8
  112. package/dist/datatypes/types/Int16.js +0 -17
  113. package/dist/datatypes/types/Int32.d.ts +0 -8
  114. package/dist/datatypes/types/Int32.js +0 -17
  115. package/dist/datatypes/types/Int64.d.ts +0 -8
  116. package/dist/datatypes/types/Int64.js +0 -17
  117. package/dist/datatypes/types/Int8.d.ts +0 -8
  118. package/dist/datatypes/types/Int8.js +0 -17
  119. package/dist/datatypes/types/List.d.ts +0 -10
  120. package/dist/datatypes/types/List.js +0 -31
  121. package/dist/datatypes/types/Null.d.ts +0 -9
  122. package/dist/datatypes/types/Null.js +0 -17
  123. package/dist/datatypes/types/Object.d.ts +0 -9
  124. package/dist/datatypes/types/Object.js +0 -17
  125. package/dist/datatypes/types/Struct.d.ts +0 -14
  126. package/dist/datatypes/types/Struct.js +0 -39
  127. package/dist/datatypes/types/Time.d.ts +0 -8
  128. package/dist/datatypes/types/Time.js +0 -29
  129. package/dist/datatypes/types/UInt16.d.ts +0 -8
  130. package/dist/datatypes/types/UInt16.js +0 -17
  131. package/dist/datatypes/types/UInt32.d.ts +0 -8
  132. package/dist/datatypes/types/UInt32.js +0 -17
  133. package/dist/datatypes/types/UInt64.d.ts +0 -8
  134. package/dist/datatypes/types/UInt64.js +0 -17
  135. package/dist/datatypes/types/UInt8.d.ts +0 -8
  136. package/dist/datatypes/types/UInt8.js +0 -17
  137. package/dist/datatypes/types/Utf8.d.ts +0 -10
  138. package/dist/datatypes/types/Utf8.js +0 -20
  139. package/dist/datatypes/types.js +0 -290
  140. package/dist/exceptions/index.js +0 -46
  141. package/dist/exceptions/utils.js +0 -28
  142. package/dist/functions/concat.js +0 -260
  143. package/dist/functions/index.js +0 -9
  144. package/dist/functions/read_csv.js +0 -53
  145. package/dist/functions/read_json.js +0 -21
  146. package/dist/functions/transpose.d.ts +0 -7
  147. package/dist/functions/transpose.js +0 -84
  148. package/dist/types.js +0 -2
  149. package/dist/utils/boolean.d.ts +0 -1
  150. package/dist/utils/boolean.js +0 -18
  151. package/dist/utils/csv.js +0 -313
  152. package/dist/utils/date.js +0 -348
  153. package/dist/utils/guards.d.ts +0 -12
  154. package/dist/utils/guards.js +0 -112
  155. package/dist/utils/index.js +0 -23
  156. package/dist/utils/json.js +0 -217
  157. package/dist/utils/list.js +0 -361
  158. package/dist/utils/number.js +0 -401
  159. package/dist/utils/string.js +0 -209
@@ -0,0 +1,567 @@
1
+ import { ExprBase } from "../ExprBase";
2
+ import { SortArrayOptions, StepSliceArrayOptions } from "../../utils";
3
+ import type { UniqueArrayStatsOptions, JoinArrayOptions, ExplodeOptions, IExpr, AnyTypedArray, ToStructOptions } from "../../types";
4
+ /**
5
+ * @namespace $df.col.arr
6
+ * @category ColumnExpression
7
+ * @syntax $df.col(<column_name>).arr.{symbol}(...)
8
+ */
9
+ export declare class ArrayExprNamespace {
10
+ expr: any;
11
+ constructor(expr: any);
12
+ _deriveArray(fn: (arr: any[] | AnyTypedArray) => any): any;
13
+ /**
14
+ * Returns true if all items in nested list cells are truthy.
15
+ * @returns ColumnExpression
16
+ * @example
17
+ * >>> const df = $df.data({ a: [[true, true], [true, false]] })
18
+ * >>> df.with_columns($df.col("a").arr.all().alias("all_true"))
19
+ * shape: (2, 2)
20
+ * ┌───────────────┬──────────┐
21
+ * │ a │ all_true │
22
+ * ├───────────────┼──────────┤
23
+ * │ [true, true] │ true │
24
+ * │ [true, false] │ false │
25
+ * └───────────────┴──────────┘
26
+ */
27
+ all(): any;
28
+ /**
29
+ * Returns true if any item in nested list cells is truthy.
30
+ * @returns ColumnExpression
31
+ * @example
32
+ * >>> const df = $df.data({ a: [[true, false], [false, false]] })
33
+ * >>> df.with_columns($df.col("a").arr.any().alias("any_true"))
34
+ * shape: (2, 2)
35
+ * ┌────────────────┬──────────┐
36
+ * │ a │ any_true │
37
+ * ├────────────────┼──────────┤
38
+ * │ [true, false] │ true │
39
+ * │ [false, false] │ false │
40
+ * └────────────────┴──────────┘
41
+ */
42
+ any(): any;
43
+ /**
44
+ * Checks if nested lists contain item.
45
+ * @param item The element to search for.
46
+ * @returns ColumnExpression
47
+ * @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"))
50
+ * shape: (2, 2)
51
+ * ┌───────────┬───────────┐
52
+ * │ a │ has_three │
53
+ * ├───────────┼───────────┤
54
+ * │ [1, 2, 3] │ true │
55
+ * │ [4, 5] │ false │
56
+ * └───────────┴───────────┘
57
+ */
58
+ contains(item: any): any;
59
+ /**
60
+ * Checks if nested lists contain all elements in items.
61
+ * @param items Array of elements that must all be present.
62
+ * @returns ColumnExpression
63
+ * @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"))
66
+ * shape: (2, 2)
67
+ * ┌───────────┬─────────┐
68
+ * │ a │ has_all │
69
+ * ├───────────┼─────────┤
70
+ * │ [1, 2, 3] │ true │
71
+ * │ [1, 5] │ false │
72
+ * └───────────┴─────────┘
73
+ */
74
+ contains_all(items: ArrayLike<any>): any;
75
+ /**
76
+ * Checks if nested lists contain any element in items.
77
+ * @param items Array of elements where at least one must be present.
78
+ * @returns ColumnExpression
79
+ * @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"))
82
+ * shape: (2, 2)
83
+ * ┌────────┬─────────┐
84
+ * │ a │ has_any │
85
+ * ├────────┼─────────┤
86
+ * │ [1, 2] │ true │
87
+ * │ [3, 4] │ true │
88
+ * └────────┴─────────┘
89
+ */
90
+ contains_any(items: ArrayLike<any>): any;
91
+ /**
92
+ * Counts occurrence frequency of item inside nested lists.
93
+ * @param item The value to count occurrences of.
94
+ * @param options Statistics and matching options.
95
+ * @returns ColumnExpression
96
+ * @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"))
99
+ * shape: (2, 2)
100
+ * ┌──────────────┬──────┐
101
+ * │ a │ twos │
102
+ * ├──────────────┼──────┤
103
+ * │ [1, 2, 2, 3] │ 2 │
104
+ * │ [4, 5] │ 0 │
105
+ * └──────────────┴──────┘
106
+ */
107
+ count_matches(item: any, options?: UniqueArrayStatsOptions): any;
108
+ /**
109
+ * Filters elements of list columns matching a boolean sub-expression.
110
+ * @param expr The boolean column expression to filter by.
111
+ * @returns ColumnExpression
112
+ * @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
+ * └────────────┴──────────┘
122
+ */
123
+ filter(expr: IExpr): any;
124
+ /**
125
+ * Expands lists into row-wise records.
126
+ * @param options Config options including handling of empty arrays and nulls.
127
+ * @returns ColumnExpression
128
+ * @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
+ * └───┘
139
+ */
140
+ explode({ empty_as_null, keep_nulls }?: ExplodeOptions): any;
141
+ /**
142
+ * Returns the first element of each list.
143
+ * @param null_on_oob If true, returns null if the list is empty (default: true).
144
+ * @returns ColumnExpression
145
+ * @example
146
+ * >>> const df = $df.data({ a: [[10, 20], [30]] })
147
+ * >>> df.with_columns($df.col("a").arr.first().alias("first_a"))
148
+ * shape: (2, 2)
149
+ * ┌──────────┬─────────┐
150
+ * │ a │ first_a │
151
+ * ├──────────┼─────────┤
152
+ * │ [10, 20] │ 10 │
153
+ * │ [30] │ 30 │
154
+ * └──────────┴─────────┘
155
+ */
156
+ first(null_on_oob?: boolean): any;
157
+ /**
158
+ * Gathers specific indices from each nested list.
159
+ * @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).
161
+ * @returns ColumnExpression
162
+ * @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"))
165
+ * shape: (2, 2)
166
+ * ┌──────────────┬──────────┐
167
+ * │ a │ g │
168
+ * ├──────────────┼──────────┤
169
+ * │ [10, 20, 30] │ [10, 30] │
170
+ * │ [40, 50] │ [40, null]│
171
+ * └──────────────┴──────────┘
172
+ */
173
+ gather(indices: number | ArrayLike<number>, null_on_oob?: boolean): any;
174
+ /**
175
+ * Gather element slices with custom steps.
176
+ * @param options Config options including offset, limit, and step size.
177
+ * @returns ColumnExpression
178
+ * @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"))
181
+ * shape: (2, 2)
182
+ * ┌──────────────┬────────┐
183
+ * │ a │ ge │
184
+ * ├──────────────┼────────┤
185
+ * │ [1, 2, 3, 4] │ [1, 3] │
186
+ * │ [5, 6, 7] │ [5, 7] │
187
+ * └──────────────┴────────┘
188
+ */
189
+ gather_every(options?: StepSliceArrayOptions): any;
190
+ /**
191
+ * Extracts a single list element by its index position.
192
+ * @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).
194
+ * @returns ColumnExpression
195
+ * @example
196
+ * >>> const df = $df.data({ a: [[10, 20], [30]] })
197
+ * >>> df.with_columns($df.col("a").arr.get(1).alias("second"))
198
+ * shape: (2, 2)
199
+ * ┌──────────┬────────┐
200
+ * │ a │ second │
201
+ * ├──────────┼────────┤
202
+ * │ [10, 20] │ 20 │
203
+ * │ [30] │ null │
204
+ * └──────────┴────────┘
205
+ */
206
+ get(index: number, null_on_oob?: boolean): any;
207
+ /**
208
+ * Joins elements of list columns into a single string column.
209
+ * @param separator The character sequence separating list elements.
210
+ * @param options String conversion options.
211
+ * @returns ColumnExpression
212
+ * @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
+ * └──────────┴────────┘
222
+ */
223
+ join(separator?: string, options?: JoinArrayOptions): any;
224
+ /**
225
+ * Returns the last element of each list.
226
+ * @param null_on_oob If true, returns null if the list is empty (default: true).
227
+ * @returns ColumnExpression
228
+ * @example
229
+ * >>> const df = $df.data({ a: [[10, 20], [30]] })
230
+ * >>> df.with_columns($df.col("a").arr.last().alias("last_a"))
231
+ * shape: (2, 2)
232
+ * ┌──────────┬────────┐
233
+ * │ a │ last_a │
234
+ * ├──────────┼────────┤
235
+ * │ [10, 20] │ 20 │
236
+ * │ [30] │ 30 │
237
+ * └──────────┴────────┐
238
+ */
239
+ last(null_on_oob?: boolean): any;
240
+ /**
241
+ * Returns the length of each list inside the column cell.
242
+ */
243
+ len(): any;
244
+ /**
245
+ * Returns the length of each list inside the column cell.
246
+ * @returns ColumnExpression
247
+ * @example
248
+ * >>> const df = $df.data({ a: [[10, 20], [30, 40, 50]] })
249
+ * >>> df.with_columns($df.col("a").arr.lengths().alias("len_a"))
250
+ * shape: (2, 2)
251
+ * ┌──────────────┬───────┐
252
+ * │ a │ len_a │
253
+ * ├──────────────┼───────┤
254
+ * │ [10, 20] │ 2 │
255
+ * │ [30, 40, 50] │ 3 │
256
+ * └──────────────┴───────┘
257
+ */
258
+ lengths(): any;
259
+ /**
260
+ * Returns the maximum value of elements inside each list.
261
+ * @returns ColumnExpression
262
+ * @example
263
+ * >>> const df = $df.data({ a: [[1, 5, 2], [10, 4]] })
264
+ * >>> df.with_columns($df.col("a").arr.max().alias("max_a"))
265
+ * shape: (2, 2)
266
+ * ┌───────────┬───────┐
267
+ * │ a │ max_a │
268
+ * ├───────────┼───────┤
269
+ * │ [1, 5, 2] │ 5 │
270
+ * │ [10, 4] │ 10 │
271
+ * └───────────┴───────┘
272
+ */
273
+ 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
+ /**
290
+ * Returns average of elements inside each list.
291
+ * @returns ColumnExpression
292
+ * @example
293
+ * >>> const df = $df.data({ a: [[1, 5, 9], [10, 40]] })
294
+ * >>> df.with_columns($df.col("a").arr.mean().alias("mean_a"))
295
+ * shape: (2, 2)
296
+ * ┌───────────┬────────┐
297
+ * │ a │ mean_a │
298
+ * ├───────────┼────────┤
299
+ * │ [1, 5, 9] │ 5 │
300
+ * │ [10, 40] │ 25 │
301
+ * └───────────┴────────┘
302
+ */
303
+ mean(): any;
304
+ /**
305
+ * Returns statistical median inside each list.
306
+ * @returns ColumnExpression
307
+ * @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
+ * └────────────────┴──────┘
317
+ */
318
+ median(): any;
319
+ /**
320
+ * Returns minimum of elements inside each list.
321
+ * @returns ColumnExpression
322
+ * @example
323
+ * >>> const df = $df.data({ a: [[1, 5, 2], [10, 4]] })
324
+ * >>> df.with_columns($df.col("a").arr.min().alias("min_a"))
325
+ * shape: (2, 2)
326
+ * ┌───────────┬───────┐
327
+ * │ a │ min_a │
328
+ * ├───────────┼───────┤
329
+ * │ [1, 5, 2] │ 1 │
330
+ * │ [10, 4] │ 4 │
331
+ * └───────────┴───────┘
332
+ */
333
+ 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
+ /**
350
+ * Returns the mode value inside each list.
351
+ * @returns ColumnExpression
352
+ * @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"))
355
+ * shape: (2, 2)
356
+ * ┌──────────────┬────────┐
357
+ * │ a │ mode_a │
358
+ * ├──────────────┼────────┤
359
+ * │ [1, 2, 2, 3] │ 2 │
360
+ * │ [5, 5, 6] │ 5 │
361
+ * └──────────────┴────────┘
362
+ */
363
+ mode(): any;
364
+ /**
365
+ * Returns the unique count of elements inside each list.
366
+ * @param options Formatting/statistics parameters.
367
+ * @returns ColumnExpression
368
+ * @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"))
371
+ * shape: (2, 2)
372
+ * ┌──────────────┬────────────┐
373
+ * │ a │ unique_len │
374
+ * ├──────────────┼────────────┤
375
+ * │ [1, 2, 2, 3] │ 3 │
376
+ * │ [4, 5] │ 2 │
377
+ * └──────────────┴────────────┘
378
+ */
379
+ n_unique(options?: UniqueArrayStatsOptions): any;
380
+ /**
381
+ * Reverses elements of list columns.
382
+ * @returns ColumnExpression
383
+ * @example
384
+ * >>> const df = $df.data({ a: [[1, 2, 3], [4, 5]] })
385
+ * >>> df.with_columns($df.col("a").arr.reverse().alias("reversed"))
386
+ * shape: (2, 2)
387
+ * ┌───────────┬───────────┐
388
+ * │ a │ reversed │
389
+ * ├───────────┼───────────┤
390
+ * │ [1, 2, 3] │ [3, 2, 1] │
391
+ * │ [4, 5] │ [5, 4] │
392
+ * └───────────┴───────────┘
393
+ */
394
+ reverse(): any;
395
+ /**
396
+ * Shifts elements of list columns by N offsets.
397
+ * @param n Positive or negative offsets shift amount (default: 1).
398
+ * @returns ColumnExpression
399
+ * @example
400
+ * >>> const df = $df.data({ a: [[1, 2, 3], [4, 5]] })
401
+ * >>> df.with_columns($df.col("a").arr.shift(1).alias("shifted"))
402
+ * shape: (2, 2)
403
+ * ┌───────────┬──────────────────┐
404
+ * │ a │ shifted │
405
+ * ├───────────┼──────────────────┤
406
+ * │ [1, 2, 3] │ [null, 1, 2] │
407
+ * │ [4, 5] │ [null, 4] │
408
+ * └───────────┴──────────────────┘
409
+ */
410
+ shift(n?: number): any;
411
+ /**
412
+ * Slices nested list arrays.
413
+ * @param start The slice starting index.
414
+ * @param end The slice ending index.
415
+ * @returns ColumnExpression
416
+ * @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"))
419
+ * shape: (2, 2)
420
+ * ┌──────────────┬────────┐
421
+ * │ a │ sliced │
422
+ * ├──────────────┼────────┤
423
+ * │ [1, 2, 3, 4] │ [2, 3] │
424
+ * │ [5, 6] │ [6] │
425
+ * └──────────────┴────────┘
426
+ */
427
+ slice(start?: number, end?: number): any;
428
+ /**
429
+ * Splices elements in list cells.
430
+ * @param start The index where array modifications begin.
431
+ * @param deleteCount The number of elements to remove.
432
+ * @param items The elements to insert.
433
+ * @returns ColumnExpression
434
+ * @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"))
437
+ * shape: (2, 2)
438
+ * ┌───────────┬─────────────────┐
439
+ * │ a │ spliced │
440
+ * ├───────────┼─────────────────┤
441
+ * │ [1, 2, 3] │ [1, 10, 20, 3] │
442
+ * │ [4, 5] │ [4, 10, 20] │
443
+ * └───────────┴─────────────────┘
444
+ */
445
+ splice(start: number, deleteCount?: number, ...items: any[]): any;
446
+ /**
447
+ * Sorts elements inside each list.
448
+ * @param options Sort customization parameters (e.g. descending flag).
449
+ * @returns ColumnExpression
450
+ * @example
451
+ * >>> const df = $df.data({ a: [[3, 1, 2], [5, 4]] })
452
+ * >>> df.with_columns($df.col("a").arr.sort().alias("sorted"))
453
+ * shape: (2, 2)
454
+ * ┌───────────┬───────────┐
455
+ * │ a │ sorted │
456
+ * ├───────────┼───────────┤
457
+ * │ [3, 1, 2] │ [1, 2, 3] │
458
+ * │ [5, 4] │ [4, 5] │
459
+ * └───────────┴───────────┘
460
+ */
461
+ sort(options?: SortArrayOptions): any;
462
+ /**
463
+ * Returns sample standard deviation of elements inside each list.
464
+ * @returns ColumnExpression
465
+ * @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
+ * └───────────┴─────────┘
475
+ */
476
+ std(): any;
477
+ /**
478
+ * Returns sum of elements inside each list.
479
+ * @returns ColumnExpression
480
+ * @example
481
+ * >>> const df = $df.data({ a: [[1, 2, 3], [10, 20]] })
482
+ * >>> df.with_columns($df.col("a").arr.sum().alias("sum_a"))
483
+ * shape: (2, 2)
484
+ * ┌───────────┬───────┐
485
+ * │ a │ sum_a │
486
+ * ├───────────┼───────┤
487
+ * │ [1, 2, 3] │ 6 │
488
+ * │ [10, 20] │ 30 │
489
+ * └───────────┴───────┘
490
+ */
491
+ sum(): any;
492
+ /**
493
+ * Converts list column elements to struct columns.
494
+ * @param options Config flags including custom field names or upper bound size.
495
+ * @returns ColumnExpression
496
+ * @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"))
499
+ * shape: (2, 2)
500
+ * ┌────────┬────────────────┐
501
+ * │ a │ struct_a │
502
+ * ├────────┼────────────────┤
503
+ * │ [1, 2] │ { x: 1, y: 2 } │
504
+ * │ [3, 4] │ { x: 3, y: 4 } │
505
+ * └────────┴────────────────┘
506
+ */
507
+ to_struct({ upper_bound, fields }?: ToStructOptions): any;
508
+ /**
509
+ * Fills each list with unique elements only.
510
+ * @param options Custom uniqueness matching configuration.
511
+ * @returns ColumnExpression
512
+ * @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"))
515
+ * shape: (2, 2)
516
+ * ┌──────────────┬───────────┐
517
+ * │ a │ unique_a │
518
+ * ├──────────────┼───────────┤
519
+ * │ [1, 2, 2, 3] │ [1, 2, 3] │
520
+ * │ [4, 4, 5] │ [4, 5] │
521
+ * └──────────────┴───────────┘
522
+ */
523
+ unique(options?: UniqueArrayStatsOptions): any;
524
+ /**
525
+ * Returns sample variance of elements inside each list.
526
+ * @returns ColumnExpression
527
+ * @example
528
+ * >>> const df = $df.data({ a: [[1, 2, 3], [10, 20]] })
529
+ * >>> df.with_columns($df.col("a").arr.variance().alias("var_a"))
530
+ * shape: (2, 2)
531
+ * ┌───────────┬───────┐
532
+ * │ a │ var_a │
533
+ * ├───────────┼───────┤
534
+ * │ [1, 2, 3] │ 1 │
535
+ * │ [10, 20] │ 50 │
536
+ * └───────────┴───────┘
537
+ */
538
+ variance(): any;
539
+ /**
540
+ * Evaluates subExpr element-wise across array lists.
541
+ * @param expr The sub-expression to evaluate inside each nested list.
542
+ * @returns ColumnExpression
543
+ * @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"))
546
+ * shape: (2, 2)
547
+ * ┌────────┬────────────┐
548
+ * │ a │ multiplied │
549
+ * ├────────┼────────────┤
550
+ * │ [1, 2] │ [10, 20] │
551
+ * │ [3, 4] │ [30, 40] │
552
+ * └────────┴────────────┘
553
+ */
554
+ eval(expr: IExpr): any;
555
+ }
556
+ export declare class ArrayExpr extends ExprBase {
557
+ /**
558
+ * Array namespace accessor for list-based column operations.
559
+ * @namespace $df.col
560
+ * @category ColumnExpression
561
+ * @syntax $df.col(<column_name>).arr
562
+ * @returns ArrayExprNamespace
563
+ * @example
564
+ * >>> df.select($df.col("a").arr.len())
565
+ */
566
+ get arr(): ArrayExprNamespace;
567
+ }