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.
- package/README.md +148 -235
- package/dist/api.d.ts +41 -36
- package/dist/columnExpressions/ColumnExpr.d.ts +5 -8
- package/dist/columnExpressions/functions/all.d.ts +13 -13
- package/dist/columnExpressions/functions/coalesce.d.ts +2 -2
- package/dist/columnExpressions/functions/duration.d.ts +16 -21
- package/dist/columnExpressions/functions/element.d.ts +10 -10
- package/dist/columnExpressions/functions/exclude.d.ts +14 -14
- package/dist/columnExpressions/functions/implode.d.ts +7 -7
- package/dist/columnExpressions/functions/lit.d.ts +9 -9
- package/dist/columnExpressions/functions/seqRange.d.ts +69 -0
- package/dist/columnExpressions/functions/struct.d.ts +6 -6
- package/dist/columnExpressions/functions/when.d.ts +25 -28
- package/dist/columnExpressions/index.d.ts +3 -7
- package/dist/columnExpressions/mixins/AggregationExpr.d.ts +550 -221
- package/dist/columnExpressions/mixins/ArithmeticExpr.d.ts +701 -327
- package/dist/columnExpressions/mixins/ArrayExpr.d.ts +508 -212
- package/dist/columnExpressions/mixins/ComparisonExpr.d.ts +398 -201
- package/dist/columnExpressions/mixins/LogicalExpr.d.ts +59 -29
- package/dist/columnExpressions/mixins/ManipulationExpr.d.ts +23 -9
- package/dist/columnExpressions/mixins/StandardExpr.d.ts +3234 -0
- package/dist/columnExpressions/mixins/StringExpr.d.ts +1163 -524
- package/dist/columnExpressions/mixins/StructExpr.d.ts +67 -25
- package/dist/columnExpressions/mixins/TemporalExpr.d.ts +518 -212
- package/dist/columnExpressions/mixins/WindowExpr.d.ts +270 -102
- package/dist/columnExpressions/typeInference.d.ts +3 -3
- package/dist/columnExpressions/types.d.ts +5 -0
- package/dist/columnExpressions/utils.d.ts +7 -0
- package/dist/constants.d.ts +11 -2
- package/dist/dataframe/dataframe.d.ts +755 -592
- package/dist/dataframe/grouped/grouped.d.ts +24 -6
- package/dist/dataframe/grouped.d.ts +70 -0
- package/dist/dataframe/index.d.ts +1 -1
- package/dist/dataframe/lazy.d.ts +37 -0
- package/dist/dataframe/types.d.ts +46 -22
- package/dist/dataframe/utils.d.ts +10 -4
- package/dist/datatypes/index.d.ts +11 -4
- package/dist/expressions.js +1 -0
- package/dist/expressions.mjs +1 -0
- package/dist/functions/concat.d.ts +68 -16
- package/dist/functions/index.d.ts +2 -2
- package/dist/functions/readCsv.d.ts +35 -0
- package/dist/functions/readJson.d.ts +33 -0
- package/dist/index.js +5 -6
- package/dist/index.mjs +5 -6
- package/dist/types.d.ts +42 -9
- package/dist/utils/array.d.ts +17 -14
- package/dist/utils/csv.d.ts +4 -1
- package/dist/utils/date.d.ts +3 -19
- package/dist/utils/duration.d.ts +7 -5
- package/dist/utils/json.d.ts +5 -3
- package/dist/utils/object.d.ts +0 -18
- package/dist/utils/string.d.ts +5 -0
- package/dist/utils.js +4 -0
- package/dist/utils.mjs +4 -0
- package/package.json +29 -8
- package/dist/assets/index-DBhGK6Tp.css +0 -1
- package/dist/assets/index-DEJEV_tU.js +0 -195
- package/dist/index.html +0 -17
|
@@ -12,80 +12,88 @@ export declare class AggregationExpr extends ExprBase {
|
|
|
12
12
|
* Aggregation: Returns true if all values in the group are truthy.
|
|
13
13
|
* @returns ColumnExpression
|
|
14
14
|
* @example
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
15
|
+
* >>> const df = $df.data({ a: [true, true, false, false], b: [true, false, true, false] })
|
|
16
|
+
* >>> df
|
|
17
|
+
* shape: (4, 2)
|
|
18
|
+
* ┌───────┬───────┐
|
|
19
|
+
* │ a │ b │
|
|
20
|
+
* ├───────┼───────┤
|
|
21
|
+
* │ true │ true │
|
|
22
|
+
* │ true │ false │
|
|
23
|
+
* │ false │ true │
|
|
24
|
+
* │ false │ false │
|
|
25
|
+
* └───────┴───────┘
|
|
26
|
+
* >>> df.select($df.col("a").all().alias("all_true"))
|
|
27
|
+
* shape: (1, 1)
|
|
28
|
+
* ┌──────────┐
|
|
29
|
+
* │ all_true │
|
|
30
|
+
* ├──────────┤
|
|
31
|
+
* │ false │
|
|
32
|
+
* └──────────┘
|
|
24
33
|
*/
|
|
25
34
|
all(): this;
|
|
26
|
-
/**
|
|
27
|
-
* Aggregation: Checks if all values in the group are null.
|
|
28
|
-
* @returns ColumnExpression
|
|
29
|
-
* @example
|
|
30
|
-
* >>> const df = $df.data({ group: ["A", "A"], val: [null, null] })
|
|
31
|
-
* >>> df.group_by("group").agg($df.col("val").all_null().alias("is_null"))
|
|
32
|
-
* shape: (1, 2)
|
|
33
|
-
* ┌───────┬─────────┐
|
|
34
|
-
* │ group │ is_null │
|
|
35
|
-
* ├───────┼─────────┤
|
|
36
|
-
* │ "A" │ true │
|
|
37
|
-
* └───────┴─────────┘
|
|
38
|
-
*/
|
|
39
|
-
all_null(): this;
|
|
40
35
|
/**
|
|
41
36
|
* Aggregation: Checks if any value in the group is truthy.
|
|
42
37
|
* @returns ColumnExpression
|
|
43
38
|
* @example
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
39
|
+
* >>> const df = $df.data({ a: [true, true, false, false], b: [true, false, true, false] })
|
|
40
|
+
* >>> df
|
|
41
|
+
* shape: (4, 2)
|
|
42
|
+
* ┌───────┬───────┐
|
|
43
|
+
* │ a │ b │
|
|
44
|
+
* ├───────┼───────┤
|
|
45
|
+
* │ true │ true │
|
|
46
|
+
* │ true │ false │
|
|
47
|
+
* │ false │ true │
|
|
48
|
+
* │ false │ false │
|
|
49
|
+
* └───────┴───────┘
|
|
50
|
+
* >>> df.select($df.col("a").any().alias("any_true"))
|
|
51
|
+
* shape: (1, 1)
|
|
52
|
+
* ┌──────────┐
|
|
53
|
+
* │ any_true │
|
|
54
|
+
* ├──────────┤
|
|
55
|
+
* │ true │
|
|
56
|
+
* └──────────┘
|
|
53
57
|
*/
|
|
54
58
|
any(): this;
|
|
55
|
-
/**
|
|
56
|
-
* Aggregation: Checks if any value in the group is null.
|
|
57
|
-
* @returns ColumnExpression
|
|
58
|
-
* @example
|
|
59
|
-
* >>> const df = $df.data({ group: ["A", "A"], val: [10, null] })
|
|
60
|
-
* >>> df.group_by("group").agg($df.col("val").any_null().alias("has_null"))
|
|
61
|
-
* shape: (1, 2)
|
|
62
|
-
* ┌───────┬──────────┐
|
|
63
|
-
* │ group │ has_null │
|
|
64
|
-
* ├───────┼──────────┤
|
|
65
|
-
* │ "A" │ true │
|
|
66
|
-
* └───────┴──────────┘
|
|
67
|
-
*/
|
|
68
|
-
any_null(): this;
|
|
69
59
|
/**
|
|
70
60
|
* Aggregation: Finds the index of the maximum value in the group.
|
|
71
61
|
* @returns ColumnExpression
|
|
72
62
|
* @example
|
|
73
|
-
|
|
74
|
-
|
|
63
|
+
* >>> const df = $df.data({ a: [1, 2, 3] })
|
|
64
|
+
* >>> df
|
|
65
|
+
* shape: (3, 1)
|
|
66
|
+
* ┌───┐
|
|
67
|
+
* │ a │
|
|
68
|
+
* ├───┤
|
|
69
|
+
* │ 1 │
|
|
70
|
+
* │ 2 │
|
|
71
|
+
* │ 3 │
|
|
72
|
+
* └───┘
|
|
73
|
+
* >>> df.select($df.col("val").argMax().alias("max_idx"))
|
|
75
74
|
* shape: (1, 1)
|
|
76
75
|
* ┌─────────┐
|
|
77
76
|
* │ max_idx │
|
|
78
77
|
* ├─────────┤
|
|
79
|
-
* │
|
|
78
|
+
* │ 2 │
|
|
80
79
|
* └─────────┘
|
|
81
80
|
*/
|
|
82
|
-
|
|
81
|
+
argMax(): this;
|
|
83
82
|
/**
|
|
84
83
|
* Aggregation: Finds the index of the minimum value in the group.
|
|
85
84
|
* @returns ColumnExpression
|
|
86
85
|
* @example
|
|
87
|
-
|
|
88
|
-
|
|
86
|
+
* >>> const df = $df.data({ a: [1, 2, 3] })
|
|
87
|
+
* >>> df
|
|
88
|
+
* shape: (3, 1)
|
|
89
|
+
* ┌───┐
|
|
90
|
+
* │ a │
|
|
91
|
+
* ├───┤
|
|
92
|
+
* │ 1 │
|
|
93
|
+
* │ 2 │
|
|
94
|
+
* │ 3 │
|
|
95
|
+
* └───┘
|
|
96
|
+
* >>> df.select($df.col("val").argMin().alias("min_idx"))
|
|
89
97
|
* shape: (1, 1)
|
|
90
98
|
* ┌─────────┐
|
|
91
99
|
* │ min_idx │
|
|
@@ -93,18 +101,28 @@ export declare class AggregationExpr extends ExprBase {
|
|
|
93
101
|
* │ 0 │
|
|
94
102
|
* └─────────┘
|
|
95
103
|
*/
|
|
96
|
-
|
|
104
|
+
argMin(): this;
|
|
97
105
|
/**
|
|
98
106
|
* Aggregation: Computes the arithmetic mean of the group.
|
|
99
107
|
* @returns ColumnExpression
|
|
100
108
|
* @example
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
109
|
+
* >>> const df = $df.data({ group: ["A", "A", "B"], val: [10, 20, 30] })
|
|
110
|
+
* >>> df
|
|
111
|
+
* shape: (3, 2)
|
|
112
|
+
* ┌───────┬─────┐
|
|
113
|
+
* │ group │ val │
|
|
114
|
+
* ├───────┼─────┤
|
|
115
|
+
* │ A │ 10 │
|
|
116
|
+
* │ A │ 20 │
|
|
117
|
+
* │ B │ 30 │
|
|
118
|
+
* └───────┴─────┘
|
|
119
|
+
* >>> df.groupBy("group").agg($df.col("val").avg().alias("mean"))
|
|
120
|
+
* shape: (2, 2)
|
|
104
121
|
* ┌───────┬──────┐
|
|
105
122
|
* │ group │ mean │
|
|
106
123
|
* ├───────┼──────┤
|
|
107
|
-
* │
|
|
124
|
+
* │ A │ 15 │
|
|
125
|
+
* │ B │ 30 │
|
|
108
126
|
* └───────┴──────┘
|
|
109
127
|
*/
|
|
110
128
|
avg(): this;
|
|
@@ -112,22 +130,40 @@ export declare class AggregationExpr extends ExprBase {
|
|
|
112
130
|
* Aggregation: Computes bitwise AND across all elements in the group.
|
|
113
131
|
* @returns ColumnExpression
|
|
114
132
|
* @example
|
|
115
|
-
|
|
116
|
-
|
|
133
|
+
* >>> const df = $df.data({ a: [1, 2, 3] })
|
|
134
|
+
* >>> df
|
|
135
|
+
* shape: (3, 1)
|
|
136
|
+
* ┌───┐
|
|
137
|
+
* │ a │
|
|
138
|
+
* ├───┤
|
|
139
|
+
* │ 1 │
|
|
140
|
+
* │ 2 │
|
|
141
|
+
* │ 3 │
|
|
142
|
+
* └───┘
|
|
143
|
+
* >>> df.select($df.col("a").bitwiseAnd().alias("res"))
|
|
117
144
|
* shape: (1, 1)
|
|
118
145
|
* ┌─────┐
|
|
119
146
|
* │ res │
|
|
120
147
|
* ├─────┤
|
|
121
|
-
* │
|
|
148
|
+
* │ 0 │
|
|
122
149
|
* └─────┘
|
|
123
150
|
*/
|
|
124
|
-
|
|
151
|
+
bitwiseAnd(): this;
|
|
125
152
|
/**
|
|
126
153
|
* Aggregation: Computes bitwise OR across all elements in the group.
|
|
127
154
|
* @returns ColumnExpression
|
|
128
155
|
* @example
|
|
129
|
-
|
|
130
|
-
|
|
156
|
+
* >>> const df = $df.data({ a: [1, 2, 3] })
|
|
157
|
+
* >>> df
|
|
158
|
+
* shape: (3, 1)
|
|
159
|
+
* ┌───┐
|
|
160
|
+
* │ a │
|
|
161
|
+
* ├───┤
|
|
162
|
+
* │ 1 │
|
|
163
|
+
* │ 2 │
|
|
164
|
+
* │ 3 │
|
|
165
|
+
* └───┘
|
|
166
|
+
* >>> df.select($df.col("a").bitwiseOr().alias("res"))
|
|
131
167
|
* shape: (1, 1)
|
|
132
168
|
* ┌─────┐
|
|
133
169
|
* │ res │
|
|
@@ -135,28 +171,46 @@ export declare class AggregationExpr extends ExprBase {
|
|
|
135
171
|
* │ 3 │
|
|
136
172
|
* └─────┘
|
|
137
173
|
*/
|
|
138
|
-
|
|
174
|
+
bitwiseOr(): this;
|
|
139
175
|
/**
|
|
140
176
|
* Aggregation: Computes bitwise XOR across all elements in the group.
|
|
141
177
|
* @returns ColumnExpression
|
|
142
178
|
* @example
|
|
143
|
-
|
|
144
|
-
|
|
179
|
+
* >>> const df = $df.data({ a: [1, 2, 3] })
|
|
180
|
+
* >>> df
|
|
181
|
+
* shape: (3, 1)
|
|
182
|
+
* ┌───┐
|
|
183
|
+
* │ a │
|
|
184
|
+
* ├───┤
|
|
185
|
+
* │ 1 │
|
|
186
|
+
* │ 2 │
|
|
187
|
+
* │ 3 │
|
|
188
|
+
* └───┘
|
|
189
|
+
* >>> df.select($df.col("a").bitwiseXor().alias("res"))
|
|
145
190
|
* shape: (1, 1)
|
|
146
191
|
* ┌─────┐
|
|
147
192
|
* │ res │
|
|
148
193
|
* ├─────┤
|
|
149
|
-
* │
|
|
194
|
+
* │ 0 │
|
|
150
195
|
* └─────┘
|
|
151
196
|
*/
|
|
152
|
-
|
|
197
|
+
bitwiseXor(): this;
|
|
153
198
|
/**
|
|
154
199
|
* Aggregation: Computes the Pearson correlation coefficient between two columns.
|
|
155
200
|
* @param other The target column expression to correlate with.
|
|
156
201
|
* @returns ColumnExpression
|
|
157
202
|
* @example
|
|
158
|
-
|
|
159
|
-
|
|
203
|
+
* >>> const df = $df.data({ a: [1, 2, 3], b: [10, 20, 30] })
|
|
204
|
+
* >>> df
|
|
205
|
+
* shape: (3, 2)
|
|
206
|
+
* ┌───┬────┐
|
|
207
|
+
* │ a │ b │
|
|
208
|
+
* ├───┼────┤
|
|
209
|
+
* │ 1 │ 10 │
|
|
210
|
+
* │ 2 │ 20 │
|
|
211
|
+
* │ 3 │ 30 │
|
|
212
|
+
* └───┴────┘
|
|
213
|
+
* >>> df.select($df.col("a").corr($df.col("b")).alias("correlation"))
|
|
160
214
|
* shape: (1, 1)
|
|
161
215
|
* ┌─────────────┐
|
|
162
216
|
* │ correlation │
|
|
@@ -170,13 +224,23 @@ export declare class AggregationExpr extends ExprBase {
|
|
|
170
224
|
* @param options Config flags including whether to count null values.
|
|
171
225
|
* @returns ColumnExpression
|
|
172
226
|
* @example
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
227
|
+
* >>> const df = $df.data({ group: ["A", "A", "B"], val: [10, 20, 30] })
|
|
228
|
+
* >>> df
|
|
229
|
+
* shape: (3, 2)
|
|
230
|
+
* ┌───────┬─────┐
|
|
231
|
+
* │ group │ val │
|
|
232
|
+
* ├───────┼─────┤
|
|
233
|
+
* │ A │ 10 │
|
|
234
|
+
* │ A │ 20 │
|
|
235
|
+
* │ B │ 30 │
|
|
236
|
+
* └───────┴─────┘
|
|
237
|
+
* >>> df.groupBy("group").agg($df.col("val").count().alias("cnt"))
|
|
238
|
+
* shape: (2, 2)
|
|
176
239
|
* ┌───────┬─────┐
|
|
177
240
|
* │ group │ cnt │
|
|
178
241
|
* ├───────┼─────┤
|
|
179
|
-
* │
|
|
242
|
+
* │ A │ 2 │
|
|
243
|
+
* │ B │ 1 │
|
|
180
244
|
* └───────┴─────┘
|
|
181
245
|
*/
|
|
182
246
|
count(options?: {
|
|
@@ -187,13 +251,22 @@ export declare class AggregationExpr extends ExprBase {
|
|
|
187
251
|
* @param other The target column expression to compute covariance with.
|
|
188
252
|
* @returns ColumnExpression
|
|
189
253
|
* @example
|
|
190
|
-
|
|
191
|
-
|
|
254
|
+
* >>> const df = $df.data({ a: [1, 2, 3], b: [10, 20, 30] })
|
|
255
|
+
* >>> df
|
|
256
|
+
* shape: (3, 2)
|
|
257
|
+
* ┌───┬────┐
|
|
258
|
+
* │ a │ b │
|
|
259
|
+
* ├───┼────┤
|
|
260
|
+
* │ 1 │ 10 │
|
|
261
|
+
* │ 2 │ 20 │
|
|
262
|
+
* │ 3 │ 30 │
|
|
263
|
+
* └───┴────┘
|
|
264
|
+
* >>> df.select($df.col("a").cov($df.col("b")).alias("covariance"))
|
|
192
265
|
* shape: (1, 1)
|
|
193
266
|
* ┌────────────┐
|
|
194
267
|
* │ covariance │
|
|
195
268
|
* ├────────────┤
|
|
196
|
-
* │
|
|
269
|
+
* │ 10 │
|
|
197
270
|
* └────────────┘
|
|
198
271
|
*/
|
|
199
272
|
cov(other: any): this;
|
|
@@ -202,13 +275,22 @@ export declare class AggregationExpr extends ExprBase {
|
|
|
202
275
|
* @param other The other column expression to compute the dot product with.
|
|
203
276
|
* @returns ColumnExpression
|
|
204
277
|
* @example
|
|
205
|
-
|
|
206
|
-
|
|
278
|
+
* >>> const df = $df.data({ a: [1, 2, 3], b: [10, 20, 30] })
|
|
279
|
+
* >>> df
|
|
280
|
+
* shape: (3, 2)
|
|
281
|
+
* ┌───┬────┐
|
|
282
|
+
* │ a │ b │
|
|
283
|
+
* ├───┼────┤
|
|
284
|
+
* │ 1 │ 10 │
|
|
285
|
+
* │ 2 │ 20 │
|
|
286
|
+
* │ 3 │ 30 │
|
|
287
|
+
* └───┴────┘
|
|
288
|
+
* >>> df.select($df.col("a").dot($df.col("b")).alias("dot_product"))
|
|
207
289
|
* shape: (1, 1)
|
|
208
290
|
* ┌─────────────┐
|
|
209
291
|
* │ dot_product │
|
|
210
292
|
* ├─────────────┤
|
|
211
|
-
* │
|
|
293
|
+
* │ 140 │
|
|
212
294
|
* └─────────────┘
|
|
213
295
|
*/
|
|
214
296
|
dot(other: any): this;
|
|
@@ -217,13 +299,22 @@ export declare class AggregationExpr extends ExprBase {
|
|
|
217
299
|
* @param options Entropy options ({ base?: number, normalize?: boolean }, default base=Math.E, normalize=true).
|
|
218
300
|
* @returns ColumnExpression
|
|
219
301
|
* @example
|
|
220
|
-
|
|
221
|
-
|
|
302
|
+
* >>> const df = $df.data({ a: [1, 2, 3] })
|
|
303
|
+
* >>> df
|
|
304
|
+
* shape: (3, 1)
|
|
305
|
+
* ┌───┐
|
|
306
|
+
* │ a │
|
|
307
|
+
* ├───┤
|
|
308
|
+
* │ 1 │
|
|
309
|
+
* │ 2 │
|
|
310
|
+
* │ 3 │
|
|
311
|
+
* └───┘
|
|
312
|
+
* >>> df.select($df.col("a").entropy().alias("h"))
|
|
222
313
|
* shape: (1, 1)
|
|
223
314
|
* ┌──────────┐
|
|
224
315
|
* │ h │
|
|
225
316
|
* ├──────────┤
|
|
226
|
-
* │ 1.
|
|
317
|
+
* │ 1.386294 │
|
|
227
318
|
* └──────────┘
|
|
228
319
|
*/
|
|
229
320
|
entropy(options?: EntropyOptions): this;
|
|
@@ -231,27 +322,70 @@ export declare class AggregationExpr extends ExprBase {
|
|
|
231
322
|
* Aggregation: Finds the first value in the group.
|
|
232
323
|
* @returns ColumnExpression
|
|
233
324
|
* @example
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
325
|
+
* >>> const df = $df.data({ group: ["A", "A", "B"], val: [10, 20, 30] })
|
|
326
|
+
* >>> df
|
|
327
|
+
* shape: (3, 2)
|
|
328
|
+
* ┌───────┬─────┐
|
|
329
|
+
* │ group │ val │
|
|
330
|
+
* ├───────┼─────┤
|
|
331
|
+
* │ A │ 10 │
|
|
332
|
+
* │ A │ 20 │
|
|
333
|
+
* │ B │ 30 │
|
|
334
|
+
* └───────┴─────┘
|
|
335
|
+
* >>> df.groupBy("group").agg($df.col("val").first().alias("first_val"))
|
|
336
|
+
* shape: (2, 2)
|
|
237
337
|
* ┌───────┬───────────┐
|
|
238
338
|
* │ group │ first_val │
|
|
239
339
|
* ├───────┼───────────┤
|
|
240
|
-
* │
|
|
340
|
+
* │ A │ 10 │
|
|
341
|
+
* │ B │ 30 │
|
|
241
342
|
* └───────┴───────────┘
|
|
242
343
|
*/
|
|
243
344
|
first(): this;
|
|
345
|
+
/**
|
|
346
|
+
* Aggregation: Checks if any value in the group is null.
|
|
347
|
+
* @returns ColumnExpression
|
|
348
|
+
* @example
|
|
349
|
+
* >>> const df = $df.data({ a: [1, null, 3], b: [null, 2, null] })
|
|
350
|
+
* >>> df
|
|
351
|
+
* shape: (3, 2)
|
|
352
|
+
* ┌──────┬──────┐
|
|
353
|
+
* │ a │ b │
|
|
354
|
+
* ├──────┼──────┤
|
|
355
|
+
* │ 1 │ null │
|
|
356
|
+
* │ null │ 2 │
|
|
357
|
+
* │ 3 │ null │
|
|
358
|
+
* └──────┴──────┘
|
|
359
|
+
* >>> df.select($df.col("a").hasNulls().alias("has_nulls"))
|
|
360
|
+
* shape: (1, 1)
|
|
361
|
+
* ┌───────────┐
|
|
362
|
+
* │ has_nulls │
|
|
363
|
+
* ├───────────┤
|
|
364
|
+
* │ true │
|
|
365
|
+
* └───────────┘
|
|
366
|
+
*/
|
|
367
|
+
hasNulls(): this;
|
|
244
368
|
/**
|
|
245
369
|
* Aggregation: Combines all values in the group into a single array/list cell.
|
|
246
370
|
* @returns ColumnExpression
|
|
247
371
|
* @example
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
372
|
+
* >>> const df = $df.data({ group: ["A", "A", "B"], val: [10, 20, 30] })
|
|
373
|
+
* >>> df
|
|
374
|
+
* shape: (3, 2)
|
|
375
|
+
* ┌───────┬─────┐
|
|
376
|
+
* │ group │ val │
|
|
377
|
+
* ├───────┼─────┤
|
|
378
|
+
* │ A │ 10 │
|
|
379
|
+
* │ A │ 20 │
|
|
380
|
+
* │ B │ 30 │
|
|
381
|
+
* └───────┴─────┘
|
|
382
|
+
* >>> df.groupBy("group").agg($df.col("val").implode().alias("list_val"))
|
|
383
|
+
* shape: (2, 2)
|
|
251
384
|
* ┌───────┬──────────┐
|
|
252
385
|
* │ group │ list_val │
|
|
253
386
|
* ├───────┼──────────┤
|
|
254
|
-
* │
|
|
387
|
+
* │ A │ [10, 20] │
|
|
388
|
+
* │ B │ [30] │
|
|
255
389
|
* └───────┴──────────┘
|
|
256
390
|
*/
|
|
257
391
|
implode(): this;
|
|
@@ -260,13 +394,22 @@ export declare class AggregationExpr extends ExprBase {
|
|
|
260
394
|
* @param options Kurtosis calculation options ({ fisher?: boolean, bias?: boolean }, default fisher=true, bias=true).
|
|
261
395
|
* @returns ColumnExpression
|
|
262
396
|
* @example
|
|
263
|
-
|
|
264
|
-
|
|
397
|
+
* >>> const df = $df.data({ a: [1, 2, 3] })
|
|
398
|
+
* >>> df
|
|
399
|
+
* shape: (3, 1)
|
|
400
|
+
* ┌───┐
|
|
401
|
+
* │ a │
|
|
402
|
+
* ├───┤
|
|
403
|
+
* │ 1 │
|
|
404
|
+
* │ 2 │
|
|
405
|
+
* │ 3 │
|
|
406
|
+
* └───┘
|
|
407
|
+
* >>> df.select($df.col("a").kurtosis().alias("kurt"))
|
|
265
408
|
* shape: (1, 1)
|
|
266
409
|
* ┌───────┐
|
|
267
410
|
* │ kurt │
|
|
268
411
|
* ├───────┤
|
|
269
|
-
* │ -1.
|
|
412
|
+
* │ -1.36 │
|
|
270
413
|
* └───────┘
|
|
271
414
|
*/
|
|
272
415
|
kurtosis(options?: KurtosisOptions): this;
|
|
@@ -274,13 +417,23 @@ export declare class AggregationExpr extends ExprBase {
|
|
|
274
417
|
* Aggregation: Finds the last value in the group.
|
|
275
418
|
* @returns ColumnExpression
|
|
276
419
|
* @example
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
420
|
+
* >>> const df = $df.data({ group: ["A", "A", "B"], val: [10, 20, 30] })
|
|
421
|
+
* >>> df
|
|
422
|
+
* shape: (3, 2)
|
|
423
|
+
* ┌───────┬─────┐
|
|
424
|
+
* │ group │ val │
|
|
425
|
+
* ├───────┼─────┤
|
|
426
|
+
* │ A │ 10 │
|
|
427
|
+
* │ A │ 20 │
|
|
428
|
+
* │ B │ 30 │
|
|
429
|
+
* └───────┴─────┘
|
|
430
|
+
* >>> df.groupBy("group").agg($df.col("val").last().alias("last_val"))
|
|
431
|
+
* shape: (2, 2)
|
|
280
432
|
* ┌───────┬──────────┐
|
|
281
433
|
* │ group │ last_val │
|
|
282
434
|
* ├───────┼──────────┤
|
|
283
|
-
* │
|
|
435
|
+
* │ A │ 20 │
|
|
436
|
+
* │ B │ 30 │
|
|
284
437
|
* └───────┴──────────┘
|
|
285
438
|
*/
|
|
286
439
|
last(): this;
|
|
@@ -288,13 +441,23 @@ export declare class AggregationExpr extends ExprBase {
|
|
|
288
441
|
* Aggregation: Finds the maximum value in the group.
|
|
289
442
|
* @returns ColumnExpression
|
|
290
443
|
* @example
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
444
|
+
* >>> const df = $df.data({ group: ["A", "A", "B"], val: [10, 20, 30] })
|
|
445
|
+
* >>> df
|
|
446
|
+
* shape: (3, 2)
|
|
447
|
+
* ┌───────┬─────┐
|
|
448
|
+
* │ group │ val │
|
|
449
|
+
* ├───────┼─────┤
|
|
450
|
+
* │ A │ 10 │
|
|
451
|
+
* │ A │ 20 │
|
|
452
|
+
* │ B │ 30 │
|
|
453
|
+
* └───────┴─────┘
|
|
454
|
+
* >>> df.groupBy("group").agg($df.col("val").max().alias("max_val"))
|
|
455
|
+
* shape: (2, 2)
|
|
294
456
|
* ┌───────┬─────────┐
|
|
295
457
|
* │ group │ max_val │
|
|
296
458
|
* ├───────┼─────────┤
|
|
297
|
-
* │
|
|
459
|
+
* │ A │ 20 │
|
|
460
|
+
* │ B │ 30 │
|
|
298
461
|
* └───────┴─────────┘
|
|
299
462
|
*/
|
|
300
463
|
max(): this;
|
|
@@ -303,27 +466,46 @@ export declare class AggregationExpr extends ExprBase {
|
|
|
303
466
|
* @param by Column or expression to order by.
|
|
304
467
|
* @returns ColumnExpression
|
|
305
468
|
* @example
|
|
306
|
-
|
|
307
|
-
|
|
469
|
+
* >>> const df = $df.data({ group: ["A", "A", "B"], val: [10, 20, 30] })
|
|
470
|
+
* >>> df
|
|
471
|
+
* shape: (3, 2)
|
|
472
|
+
* ┌───────┬─────┐
|
|
473
|
+
* │ group │ val │
|
|
474
|
+
* ├───────┼─────┤
|
|
475
|
+
* │ A │ 10 │
|
|
476
|
+
* │ A │ 20 │
|
|
477
|
+
* │ B │ 30 │
|
|
478
|
+
* └───────┴─────┘
|
|
479
|
+
* >>> df.select($df.col("group").maxBy($df.col("val")).alias("top_group"))
|
|
308
480
|
* shape: (1, 1)
|
|
309
|
-
*
|
|
310
|
-
* │
|
|
311
|
-
*
|
|
312
|
-
* │
|
|
313
|
-
*
|
|
481
|
+
* ┌───────────┐
|
|
482
|
+
* │ top_group │
|
|
483
|
+
* ├───────────┤
|
|
484
|
+
* │ B │
|
|
485
|
+
* └───────────┘
|
|
314
486
|
*/
|
|
315
|
-
|
|
487
|
+
maxBy(by: any): this;
|
|
316
488
|
/**
|
|
317
489
|
* Aggregation: Computes the arithmetic mean of elements in the group.
|
|
318
490
|
* @returns ColumnExpression
|
|
319
491
|
* @example
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
492
|
+
* >>> const df = $df.data({ group: ["A", "A", "B"], val: [10, 20, 30] })
|
|
493
|
+
* >>> df
|
|
494
|
+
* shape: (3, 2)
|
|
495
|
+
* ┌───────┬─────┐
|
|
496
|
+
* │ group │ val │
|
|
497
|
+
* ├───────┼─────┤
|
|
498
|
+
* │ A │ 10 │
|
|
499
|
+
* │ A │ 20 │
|
|
500
|
+
* │ B │ 30 │
|
|
501
|
+
* └───────┴─────┘
|
|
502
|
+
* >>> df.groupBy("group").agg($df.col("val").mean().alias("mean_val"))
|
|
503
|
+
* shape: (2, 2)
|
|
323
504
|
* ┌───────┬──────────┐
|
|
324
505
|
* │ group │ mean_val │
|
|
325
506
|
* ├───────┼──────────┤
|
|
326
|
-
* │
|
|
507
|
+
* │ A │ 15 │
|
|
508
|
+
* │ B │ 30 │
|
|
327
509
|
* └───────┴──────────┘
|
|
328
510
|
*/
|
|
329
511
|
mean(): this;
|
|
@@ -331,13 +513,23 @@ export declare class AggregationExpr extends ExprBase {
|
|
|
331
513
|
* Aggregation: Computes the 50th percentile median.
|
|
332
514
|
* @returns ColumnExpression
|
|
333
515
|
* @example
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
516
|
+
* >>> const df = $df.data({ group: ["A", "A", "B"], val: [10, 20, 30] })
|
|
517
|
+
* >>> df
|
|
518
|
+
* shape: (3, 2)
|
|
519
|
+
* ┌───────┬─────┐
|
|
520
|
+
* │ group │ val │
|
|
521
|
+
* ├───────┼─────┤
|
|
522
|
+
* │ A │ 10 │
|
|
523
|
+
* │ A │ 20 │
|
|
524
|
+
* │ B │ 30 │
|
|
525
|
+
* └───────┴─────┘
|
|
526
|
+
* >>> df.groupBy("group").agg($df.col("val").median().alias("med"))
|
|
527
|
+
* shape: (2, 2)
|
|
337
528
|
* ┌───────┬─────┐
|
|
338
529
|
* │ group │ med │
|
|
339
530
|
* ├───────┼─────┤
|
|
340
|
-
* │
|
|
531
|
+
* │ A │ 15 │
|
|
532
|
+
* │ B │ 30 │
|
|
341
533
|
* └───────┴─────┘
|
|
342
534
|
*/
|
|
343
535
|
median(): this;
|
|
@@ -345,13 +537,23 @@ export declare class AggregationExpr extends ExprBase {
|
|
|
345
537
|
* Aggregation: Finds the minimum value in the group.
|
|
346
538
|
* @returns ColumnExpression
|
|
347
539
|
* @example
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
540
|
+
* >>> const df = $df.data({ group: ["A", "A", "B"], val: [10, 20, 30] })
|
|
541
|
+
* >>> df
|
|
542
|
+
* shape: (3, 2)
|
|
543
|
+
* ┌───────┬─────┐
|
|
544
|
+
* │ group │ val │
|
|
545
|
+
* ├───────┼─────┤
|
|
546
|
+
* │ A │ 10 │
|
|
547
|
+
* │ A │ 20 │
|
|
548
|
+
* │ B │ 30 │
|
|
549
|
+
* └───────┴─────┘
|
|
550
|
+
* >>> df.groupBy("group").agg($df.col("val").min().alias("min_val"))
|
|
551
|
+
* shape: (2, 2)
|
|
351
552
|
* ┌───────┬─────────┐
|
|
352
553
|
* │ group │ min_val │
|
|
353
554
|
* ├───────┼─────────┤
|
|
354
|
-
* │
|
|
555
|
+
* │ A │ 10 │
|
|
556
|
+
* │ B │ 30 │
|
|
355
557
|
* └───────┴─────────┘
|
|
356
558
|
*/
|
|
357
559
|
min(): this;
|
|
@@ -360,28 +562,46 @@ export declare class AggregationExpr extends ExprBase {
|
|
|
360
562
|
* @param by Column or expression to order by.
|
|
361
563
|
* @returns ColumnExpression
|
|
362
564
|
* @example
|
|
363
|
-
|
|
364
|
-
|
|
565
|
+
* >>> const df = $df.data({ group: ["A", "A", "B"], val: [10, 20, 30] })
|
|
566
|
+
* >>> df
|
|
567
|
+
* shape: (3, 2)
|
|
568
|
+
* ┌───────┬─────┐
|
|
569
|
+
* │ group │ val │
|
|
570
|
+
* ├───────┼─────┤
|
|
571
|
+
* │ A │ 10 │
|
|
572
|
+
* │ A │ 20 │
|
|
573
|
+
* │ B │ 30 │
|
|
574
|
+
* └───────┴─────┘
|
|
575
|
+
* >>> df.select($df.col("group").minBy($df.col("val")).alias("lowest_group"))
|
|
365
576
|
* shape: (1, 1)
|
|
366
577
|
* ┌──────────────┐
|
|
367
|
-
* │
|
|
578
|
+
* │ lowest_group │
|
|
368
579
|
* ├──────────────┤
|
|
369
|
-
* │
|
|
580
|
+
* │ A │
|
|
370
581
|
* └──────────────┘
|
|
371
582
|
*/
|
|
372
|
-
|
|
583
|
+
minBy(by: any): this;
|
|
373
584
|
/**
|
|
374
585
|
* Aggregation: Finds the statistical mode (most frequent value).
|
|
375
586
|
* @returns ColumnExpression
|
|
376
587
|
* @example
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
588
|
+
* >>> const df = $df.data({ group: ["A", "A", "B"], val: [10, 20, 30] })
|
|
589
|
+
* >>> df
|
|
590
|
+
* shape: (3, 2)
|
|
591
|
+
* ┌───────┬─────┐
|
|
592
|
+
* │ group │ val │
|
|
593
|
+
* ├───────┼─────┤
|
|
594
|
+
* │ A │ 10 │
|
|
595
|
+
* │ A │ 20 │
|
|
596
|
+
* │ B │ 30 │
|
|
597
|
+
* └───────┴─────┘
|
|
598
|
+
* >>> df.select($df.col("group").mode().alias("mode_group"))
|
|
599
|
+
* shape: (1, 1)
|
|
600
|
+
* ┌────────────┐
|
|
601
|
+
* │ mode_group │
|
|
602
|
+
* ├────────────┤
|
|
603
|
+
* │ ["A"] │
|
|
604
|
+
* └────────────┘
|
|
385
605
|
*/
|
|
386
606
|
mode(): this;
|
|
387
607
|
/**
|
|
@@ -389,85 +609,140 @@ export declare class AggregationExpr extends ExprBase {
|
|
|
389
609
|
* @param options Uniqueness options.
|
|
390
610
|
* @returns ColumnExpression
|
|
391
611
|
* @example
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
|
|
612
|
+
* >>> const df = $df.data({ group: ["A", "A", "B"], val: [10, 20, 30] })
|
|
613
|
+
* >>> df
|
|
614
|
+
* shape: (3, 2)
|
|
615
|
+
* ┌───────┬─────┐
|
|
616
|
+
* │ group │ val │
|
|
617
|
+
* ├───────┼─────┤
|
|
618
|
+
* │ A │ 10 │
|
|
619
|
+
* │ A │ 20 │
|
|
620
|
+
* │ B │ 30 │
|
|
621
|
+
* └───────┴─────┘
|
|
622
|
+
* >>> df.select($df.col("group").nUnique().alias("unique_cnt"))
|
|
623
|
+
* shape: (1, 1)
|
|
624
|
+
* ┌────────────┐
|
|
625
|
+
* │ unique_cnt │
|
|
626
|
+
* ├────────────┤
|
|
627
|
+
* │ 2 │
|
|
628
|
+
* └────────────┘
|
|
400
629
|
*/
|
|
401
|
-
|
|
630
|
+
nUnique(options?: UniqueArrayStatsOptions): this;
|
|
402
631
|
/**
|
|
403
632
|
* Aggregation: Finds the maximum value in the group, taking NaN values into account (NaN propagates).
|
|
404
633
|
* @returns ColumnExpression
|
|
405
634
|
* @example
|
|
406
|
-
|
|
407
|
-
|
|
408
|
-
|
|
409
|
-
|
|
410
|
-
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
|
|
635
|
+
* >>> const df = $df.data({ a: [1, 2, 3] })
|
|
636
|
+
* >>> df
|
|
637
|
+
* shape: (3, 1)
|
|
638
|
+
* ┌───┐
|
|
639
|
+
* │ a │
|
|
640
|
+
* ├───┤
|
|
641
|
+
* │ 1 │
|
|
642
|
+
* │ 2 │
|
|
643
|
+
* │ 3 │
|
|
644
|
+
* └───┘
|
|
645
|
+
* >>> df.select($df.col("val").nanMax().alias("nan_max_val"))
|
|
646
|
+
* shape: (1, 1)
|
|
647
|
+
* ┌─────────────┐
|
|
648
|
+
* │ nan_max_val │
|
|
649
|
+
* ├─────────────┤
|
|
650
|
+
* │ 30 │
|
|
651
|
+
* └─────────────┘
|
|
414
652
|
*/
|
|
415
|
-
|
|
653
|
+
nanMax(): this;
|
|
416
654
|
/**
|
|
417
655
|
* Aggregation: Finds the minimum value in the group, taking NaN values into account (NaN propagates).
|
|
418
656
|
* @returns ColumnExpression
|
|
419
657
|
* @example
|
|
420
|
-
|
|
421
|
-
|
|
422
|
-
|
|
423
|
-
|
|
424
|
-
|
|
425
|
-
|
|
426
|
-
|
|
427
|
-
|
|
658
|
+
* >>> const df = $df.data({ a: [1, 2, 3] })
|
|
659
|
+
* >>> df
|
|
660
|
+
* shape: (3, 1)
|
|
661
|
+
* ┌───┐
|
|
662
|
+
* │ a │
|
|
663
|
+
* ├───┤
|
|
664
|
+
* │ 1 │
|
|
665
|
+
* │ 2 │
|
|
666
|
+
* │ 3 │
|
|
667
|
+
* └───┘
|
|
668
|
+
* >>> df.select($df.col("val").nanMin().alias("nan_min_val"))
|
|
669
|
+
* shape: (1, 1)
|
|
670
|
+
* ┌─────────────┐
|
|
671
|
+
* │ nan_min_val │
|
|
672
|
+
* ├─────────────┤
|
|
673
|
+
* │ 10 │
|
|
674
|
+
* └─────────────┘
|
|
428
675
|
*/
|
|
429
|
-
|
|
676
|
+
nanMin(): this;
|
|
430
677
|
/**
|
|
431
678
|
* Aggregation: Counts the number of null or missing records.
|
|
432
679
|
* @returns ColumnExpression
|
|
433
680
|
* @example
|
|
434
|
-
|
|
435
|
-
|
|
436
|
-
|
|
437
|
-
|
|
438
|
-
|
|
439
|
-
|
|
440
|
-
|
|
441
|
-
|
|
681
|
+
* >>> const df = $df.data({ a: [1, null, 3], b: [null, 2, null] })
|
|
682
|
+
* >>> df
|
|
683
|
+
* shape: (3, 2)
|
|
684
|
+
* ┌──────┬──────┐
|
|
685
|
+
* │ a │ b │
|
|
686
|
+
* ├──────┼──────┤
|
|
687
|
+
* │ 1 │ null │
|
|
688
|
+
* │ null │ 2 │
|
|
689
|
+
* │ 3 │ null │
|
|
690
|
+
* └──────┴──────┘
|
|
691
|
+
* >>> df.select($df.col("a").nullCount().alias("nulls"))
|
|
692
|
+
* shape: (1, 1)
|
|
693
|
+
* ┌───────┐
|
|
694
|
+
* │ nulls │
|
|
695
|
+
* ├───────┤
|
|
696
|
+
* │ 1 │
|
|
697
|
+
* └───────┘
|
|
442
698
|
*/
|
|
443
|
-
|
|
699
|
+
nullCount(): this;
|
|
444
700
|
/**
|
|
445
701
|
* Aggregation: Computes the specific quantile values (0.0 to 1.0).
|
|
446
702
|
* @param q The quantile parameter value between 0.0 and 1.0.
|
|
447
703
|
* @returns ColumnExpression
|
|
448
704
|
* @example
|
|
449
|
-
|
|
450
|
-
|
|
705
|
+
* >>> const df = $df.data({ a: [1, 2, 3] })
|
|
706
|
+
* >>> df
|
|
707
|
+
* shape: (3, 1)
|
|
708
|
+
* ┌───┐
|
|
709
|
+
* │ a │
|
|
710
|
+
* ├───┤
|
|
711
|
+
* │ 1 │
|
|
712
|
+
* │ 2 │
|
|
713
|
+
* │ 3 │
|
|
714
|
+
* └───┘
|
|
715
|
+
* >>> df.select($df.col("a").quantile(0.75).alias("q75"))
|
|
451
716
|
* shape: (1, 1)
|
|
452
|
-
*
|
|
453
|
-
* │ q75
|
|
454
|
-
*
|
|
455
|
-
* │
|
|
456
|
-
*
|
|
717
|
+
* ┌──────┐
|
|
718
|
+
* │ q75 │
|
|
719
|
+
* ├──────┤
|
|
720
|
+
* │ 3.25 │
|
|
721
|
+
* └──────┘
|
|
457
722
|
*/
|
|
458
723
|
quantile(q: number): this;
|
|
459
724
|
/**
|
|
460
725
|
* Aggregation: Computes the product of all elements in the group.
|
|
461
726
|
* @returns ColumnExpression
|
|
462
727
|
* @example
|
|
463
|
-
|
|
464
|
-
|
|
465
|
-
|
|
466
|
-
|
|
467
|
-
|
|
468
|
-
|
|
469
|
-
|
|
470
|
-
|
|
728
|
+
* >>> const df = $df.data({ group: ["A", "A", "B"], val: [10, 20, 30] })
|
|
729
|
+
* >>> df
|
|
730
|
+
* shape: (3, 2)
|
|
731
|
+
* ┌───────┬─────┐
|
|
732
|
+
* │ group │ val │
|
|
733
|
+
* ├───────┼─────┤
|
|
734
|
+
* │ A │ 10 │
|
|
735
|
+
* │ A │ 20 │
|
|
736
|
+
* │ B │ 30 │
|
|
737
|
+
* └───────┴─────┘
|
|
738
|
+
* >>> df.groupBy("group").agg($df.col("val").product().alias("p"))
|
|
739
|
+
* shape: (2, 2)
|
|
740
|
+
* ┌───────┬─────┐
|
|
741
|
+
* │ group │ p │
|
|
742
|
+
* ├───────┼─────┤
|
|
743
|
+
* │ A │ 200 │
|
|
744
|
+
* │ B │ 30 │
|
|
745
|
+
* └───────┴─────┘
|
|
471
746
|
*/
|
|
472
747
|
product(): this;
|
|
473
748
|
/**
|
|
@@ -475,24 +750,41 @@ export declare class AggregationExpr extends ExprBase {
|
|
|
475
750
|
* @param options Skew calculation options ({ bias?: boolean }, default bias=true).
|
|
476
751
|
* @returns ColumnExpression
|
|
477
752
|
* @example
|
|
478
|
-
|
|
479
|
-
|
|
753
|
+
* >>> const df = $df.data({ a: [1, 2, 3] })
|
|
754
|
+
* >>> df
|
|
755
|
+
* shape: (3, 1)
|
|
756
|
+
* ┌───┐
|
|
757
|
+
* │ a │
|
|
758
|
+
* ├───┤
|
|
759
|
+
* │ 1 │
|
|
760
|
+
* │ 2 │
|
|
761
|
+
* │ 3 │
|
|
762
|
+
* └───┘
|
|
763
|
+
* >>> df.select($df.col("a").skew().alias("skewness"))
|
|
480
764
|
* shape: (1, 1)
|
|
481
765
|
* ┌──────────┐
|
|
482
766
|
* │ skewness │
|
|
483
767
|
* ├──────────┤
|
|
484
|
-
* │ 0
|
|
768
|
+
* │ 0 │
|
|
485
769
|
* └──────────┘
|
|
486
770
|
*/
|
|
487
771
|
skew(options?: SkewOptions): this;
|
|
488
772
|
/**
|
|
489
773
|
* Aggregation: Computes the Spearman rank correlation coefficient.
|
|
490
|
-
|
|
491
774
|
* @param other The other column expression to correlate with.
|
|
492
775
|
* @returns ColumnExpression
|
|
493
776
|
* @example
|
|
494
|
-
|
|
495
|
-
|
|
777
|
+
* >>> const df = $df.data({ a: [1, 2, 3], b: [10, 20, 30] })
|
|
778
|
+
* >>> df
|
|
779
|
+
* shape: (3, 2)
|
|
780
|
+
* ┌───┬────┐
|
|
781
|
+
* │ a │ b │
|
|
782
|
+
* ├───┼────┤
|
|
783
|
+
* │ 1 │ 10 │
|
|
784
|
+
* │ 2 │ 20 │
|
|
785
|
+
* │ 3 │ 30 │
|
|
786
|
+
* └───┴────┘
|
|
787
|
+
* >>> df.select($df.col("a").spearmanCorr($df.col("b")).alias("spearman"))
|
|
496
788
|
* shape: (1, 1)
|
|
497
789
|
* ┌──────────┐
|
|
498
790
|
* │ spearman │
|
|
@@ -500,32 +792,51 @@ export declare class AggregationExpr extends ExprBase {
|
|
|
500
792
|
* │ 1 │
|
|
501
793
|
* └──────────┘
|
|
502
794
|
*/
|
|
503
|
-
|
|
795
|
+
spearmanCorr(other: any): this;
|
|
504
796
|
/**
|
|
505
797
|
* Aggregation: Computes sample standard deviation.
|
|
506
798
|
* @returns ColumnExpression
|
|
507
799
|
* @example
|
|
508
|
-
|
|
509
|
-
|
|
510
|
-
|
|
511
|
-
|
|
512
|
-
|
|
513
|
-
|
|
514
|
-
|
|
515
|
-
|
|
800
|
+
* >>> const df = $df.data({ a: [1, 2, 3] })
|
|
801
|
+
* >>> df
|
|
802
|
+
* shape: (3, 1)
|
|
803
|
+
* ┌───┐
|
|
804
|
+
* │ a │
|
|
805
|
+
* ├───┤
|
|
806
|
+
* │ 1 │
|
|
807
|
+
* │ 2 │
|
|
808
|
+
* │ 3 │
|
|
809
|
+
* └───┘
|
|
810
|
+
* >>> df.select($df.col("val").std().alias("std_dev"))
|
|
811
|
+
* shape: (1, 1)
|
|
812
|
+
* ┌─────────┐
|
|
813
|
+
* │ std_dev │
|
|
814
|
+
* ├─────────┤
|
|
815
|
+
* │ 10 │
|
|
816
|
+
* └─────────┘
|
|
516
817
|
*/
|
|
517
818
|
std(): this;
|
|
518
819
|
/**
|
|
519
820
|
* Aggregation: Computes the sum of elements in the group.
|
|
520
821
|
* @returns ColumnExpression
|
|
521
822
|
* @example
|
|
522
|
-
|
|
523
|
-
|
|
524
|
-
|
|
823
|
+
* >>> const df = $df.data({ group: ["A", "A", "B"], val: [10, 20, 30] })
|
|
824
|
+
* >>> df
|
|
825
|
+
* shape: (3, 2)
|
|
826
|
+
* ┌───────┬─────┐
|
|
827
|
+
* │ group │ val │
|
|
828
|
+
* ├───────┼─────┤
|
|
829
|
+
* │ A │ 10 │
|
|
830
|
+
* │ A │ 20 │
|
|
831
|
+
* │ B │ 30 │
|
|
832
|
+
* └───────┴─────┘
|
|
833
|
+
* >>> df.groupBy("group").agg($df.col("val").sum().alias("total"))
|
|
834
|
+
* shape: (2, 2)
|
|
525
835
|
* ┌───────┬───────┐
|
|
526
836
|
* │ group │ total │
|
|
527
837
|
* ├───────┼───────┤
|
|
528
|
-
* │
|
|
838
|
+
* │ A │ 30 │
|
|
839
|
+
* │ B │ 30 │
|
|
529
840
|
* └───────┴───────┘
|
|
530
841
|
*/
|
|
531
842
|
sum(): this;
|
|
@@ -533,14 +844,23 @@ export declare class AggregationExpr extends ExprBase {
|
|
|
533
844
|
* Aggregation: Computes sample variance.
|
|
534
845
|
* @returns ColumnExpression
|
|
535
846
|
* @example
|
|
536
|
-
|
|
537
|
-
|
|
538
|
-
|
|
539
|
-
|
|
540
|
-
|
|
541
|
-
|
|
542
|
-
|
|
543
|
-
|
|
847
|
+
* >>> const df = $df.data({ a: [1, 2, 3] })
|
|
848
|
+
* >>> df
|
|
849
|
+
* shape: (3, 1)
|
|
850
|
+
* ┌───┐
|
|
851
|
+
* │ a │
|
|
852
|
+
* ├───┤
|
|
853
|
+
* │ 1 │
|
|
854
|
+
* │ 2 │
|
|
855
|
+
* │ 3 │
|
|
856
|
+
* └───┘
|
|
857
|
+
* >>> df.select($df.col("val").variance().alias("v"))
|
|
858
|
+
* shape: (1, 1)
|
|
859
|
+
* ┌─────┐
|
|
860
|
+
* │ v │
|
|
861
|
+
* ├─────┤
|
|
862
|
+
* │ 100 │
|
|
863
|
+
* └─────┘
|
|
544
864
|
*/
|
|
545
865
|
variance(): this;
|
|
546
866
|
/**
|
|
@@ -548,14 +868,23 @@ export declare class AggregationExpr extends ExprBase {
|
|
|
548
868
|
* @param weights The weight values or column expression.
|
|
549
869
|
* @returns ColumnExpression
|
|
550
870
|
* @example
|
|
551
|
-
|
|
552
|
-
|
|
871
|
+
* >>> const df = $df.data({ a: [1, 2, 3], b: [10, 20, 30] })
|
|
872
|
+
* >>> df
|
|
873
|
+
* shape: (3, 2)
|
|
874
|
+
* ┌───┬────┐
|
|
875
|
+
* │ a │ b │
|
|
876
|
+
* ├───┼────┤
|
|
877
|
+
* │ 1 │ 10 │
|
|
878
|
+
* │ 2 │ 20 │
|
|
879
|
+
* │ 3 │ 30 │
|
|
880
|
+
* └───┴────┘
|
|
881
|
+
* >>> df.select($df.col("a").wAvg($df.col("b")).alias("w_mean"))
|
|
553
882
|
* shape: (1, 1)
|
|
554
|
-
*
|
|
555
|
-
* │ w_mean
|
|
556
|
-
*
|
|
557
|
-
* │
|
|
558
|
-
*
|
|
883
|
+
* ┌──────────┐
|
|
884
|
+
* │ w_mean │
|
|
885
|
+
* ├──────────┤
|
|
886
|
+
* │ 2.333333 │
|
|
887
|
+
* └──────────┘
|
|
559
888
|
*/
|
|
560
|
-
|
|
889
|
+
wAvg(weights: any): this;
|
|
561
890
|
}
|