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
|
@@ -10,48 +10,75 @@ export declare class ArithmeticExpr extends ExprBase {
|
|
|
10
10
|
* Computes the absolute value of the column values.
|
|
11
11
|
* @returns ColumnExpression
|
|
12
12
|
* @example
|
|
13
|
-
|
|
14
|
-
|
|
13
|
+
* >>> const df = $df.data({ a: [1, 2, 3] })
|
|
14
|
+
* >>> df
|
|
15
|
+
* shape: (3, 1)
|
|
16
|
+
* ┌───┐
|
|
17
|
+
* │ a │
|
|
18
|
+
* ├───┤
|
|
19
|
+
* │ 1 │
|
|
20
|
+
* │ 2 │
|
|
21
|
+
* │ 3 │
|
|
22
|
+
* └───┘
|
|
23
|
+
* >>> df.withColumns($df.col("a").abs().alias("abs_a"))
|
|
15
24
|
* shape: (3, 2)
|
|
16
|
-
*
|
|
17
|
-
* │ a
|
|
18
|
-
*
|
|
19
|
-
* │
|
|
20
|
-
* │ 2
|
|
21
|
-
* │
|
|
22
|
-
*
|
|
25
|
+
* ┌───┬───────┐
|
|
26
|
+
* │ a │ abs_a │
|
|
27
|
+
* ├───┼───────┤
|
|
28
|
+
* │ 1 │ 1 │
|
|
29
|
+
* │ 2 │ 2 │
|
|
30
|
+
* │ 3 │ 3 │
|
|
31
|
+
* └───┴───────┘
|
|
23
32
|
*/
|
|
24
33
|
abs(): this;
|
|
25
34
|
/**
|
|
26
35
|
* Computes the mathematical arccosine (inverse cosine) of the column values.
|
|
27
36
|
* @returns ColumnExpression
|
|
28
37
|
* @example
|
|
29
|
-
|
|
30
|
-
|
|
38
|
+
* >>> const df = $df.data({ a: [1, 2, 3] })
|
|
39
|
+
* >>> df
|
|
40
|
+
* shape: (3, 1)
|
|
41
|
+
* ┌───┐
|
|
42
|
+
* │ a │
|
|
43
|
+
* ├───┤
|
|
44
|
+
* │ 1 │
|
|
45
|
+
* │ 2 │
|
|
46
|
+
* │ 3 │
|
|
47
|
+
* └───┘
|
|
48
|
+
* >>> df.withColumns($df.col("a").acos().alias("acos_a"))
|
|
31
49
|
* shape: (3, 2)
|
|
32
|
-
*
|
|
33
|
-
* │ a
|
|
34
|
-
*
|
|
35
|
-
* │
|
|
36
|
-
* │
|
|
37
|
-
* │
|
|
38
|
-
*
|
|
50
|
+
* ┌───┬────────┐
|
|
51
|
+
* │ a │ acos_a │
|
|
52
|
+
* ├───┼────────┤
|
|
53
|
+
* │ 1 │ 0 │
|
|
54
|
+
* │ 2 │ null │
|
|
55
|
+
* │ 3 │ null │
|
|
56
|
+
* └───┴────────┘
|
|
39
57
|
*/
|
|
40
58
|
acos(): this;
|
|
41
59
|
/**
|
|
42
60
|
* Computes the hyperbolic arccosine of the column values.
|
|
43
61
|
* @returns ColumnExpression
|
|
44
62
|
* @example
|
|
45
|
-
|
|
46
|
-
|
|
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.withColumns($df.col("a").acosh().alias("acosh_a"))
|
|
47
74
|
* shape: (3, 2)
|
|
48
|
-
*
|
|
49
|
-
* │ a │ acosh_a
|
|
50
|
-
*
|
|
51
|
-
* │ 1 │ 0
|
|
52
|
-
* │ 2 │ 1.
|
|
53
|
-
* │
|
|
54
|
-
*
|
|
75
|
+
* ┌───┬──────────┐
|
|
76
|
+
* │ a │ acosh_a │
|
|
77
|
+
* ├───┼──────────┤
|
|
78
|
+
* │ 1 │ 0 │
|
|
79
|
+
* │ 2 │ 1.316958 │
|
|
80
|
+
* │ 3 │ 1.762747 │
|
|
81
|
+
* └───┴──────────┘
|
|
55
82
|
*/
|
|
56
83
|
acosh(): this;
|
|
57
84
|
/**
|
|
@@ -59,8 +86,17 @@ export declare class ArithmeticExpr extends ExprBase {
|
|
|
59
86
|
* @param val The number or column expression to add.
|
|
60
87
|
* @returns ColumnExpression
|
|
61
88
|
* @example
|
|
62
|
-
|
|
63
|
-
|
|
89
|
+
* >>> const df = $df.data({ a: [1, 2, 3] })
|
|
90
|
+
* >>> df
|
|
91
|
+
* shape: (3, 1)
|
|
92
|
+
* ┌───┐
|
|
93
|
+
* │ a │
|
|
94
|
+
* ├───┤
|
|
95
|
+
* │ 1 │
|
|
96
|
+
* │ 2 │
|
|
97
|
+
* │ 3 │
|
|
98
|
+
* └───┘
|
|
99
|
+
* >>> df.withColumns($df.col("a").add(10).alias("added"))
|
|
64
100
|
* shape: (3, 2)
|
|
65
101
|
* ┌───┬───────┐
|
|
66
102
|
* │ a │ added │
|
|
@@ -75,48 +111,75 @@ export declare class ArithmeticExpr extends ExprBase {
|
|
|
75
111
|
* Computes the arcsine of the column values.
|
|
76
112
|
* @returns ColumnExpression
|
|
77
113
|
* @example
|
|
78
|
-
|
|
79
|
-
|
|
114
|
+
* >>> const df = $df.data({ a: [1, 2, 3] })
|
|
115
|
+
* >>> df
|
|
116
|
+
* shape: (3, 1)
|
|
117
|
+
* ┌───┐
|
|
118
|
+
* │ a │
|
|
119
|
+
* ├───┤
|
|
120
|
+
* │ 1 │
|
|
121
|
+
* │ 2 │
|
|
122
|
+
* │ 3 │
|
|
123
|
+
* └───┘
|
|
124
|
+
* >>> df.withColumns($df.col("a").asin().alias("asin_a"))
|
|
80
125
|
* shape: (3, 2)
|
|
81
|
-
*
|
|
82
|
-
* │ a
|
|
83
|
-
*
|
|
84
|
-
* │
|
|
85
|
-
* │
|
|
86
|
-
* │
|
|
87
|
-
*
|
|
126
|
+
* ┌───┬──────────┐
|
|
127
|
+
* │ a │ asin_a │
|
|
128
|
+
* ├───┼──────────┤
|
|
129
|
+
* │ 1 │ 1.570796 │
|
|
130
|
+
* │ 2 │ null │
|
|
131
|
+
* │ 3 │ null │
|
|
132
|
+
* └───┴──────────┘
|
|
88
133
|
*/
|
|
89
134
|
asin(): this;
|
|
90
135
|
/**
|
|
91
136
|
* Computes the hyperbolic arcsine of the column values.
|
|
92
137
|
* @returns ColumnExpression
|
|
93
138
|
* @example
|
|
94
|
-
|
|
95
|
-
|
|
139
|
+
* >>> const df = $df.data({ a: [1, 2, 3] })
|
|
140
|
+
* >>> df
|
|
141
|
+
* shape: (3, 1)
|
|
142
|
+
* ┌───┐
|
|
143
|
+
* │ a │
|
|
144
|
+
* ├───┤
|
|
145
|
+
* │ 1 │
|
|
146
|
+
* │ 2 │
|
|
147
|
+
* │ 3 │
|
|
148
|
+
* └───┘
|
|
149
|
+
* >>> df.withColumns($df.col("a").asinh().alias("asinh_a"))
|
|
96
150
|
* shape: (3, 2)
|
|
97
|
-
*
|
|
98
|
-
* │ a │ asinh_a
|
|
99
|
-
*
|
|
100
|
-
* │
|
|
101
|
-
* │
|
|
102
|
-
* │
|
|
103
|
-
*
|
|
151
|
+
* ┌───┬──────────┐
|
|
152
|
+
* │ a │ asinh_a │
|
|
153
|
+
* ├───┼──────────┤
|
|
154
|
+
* │ 1 │ 0.881374 │
|
|
155
|
+
* │ 2 │ 1.443635 │
|
|
156
|
+
* │ 3 │ 1.818446 │
|
|
157
|
+
* └───┴──────────┘
|
|
104
158
|
*/
|
|
105
159
|
asinh(): this;
|
|
106
160
|
/**
|
|
107
161
|
* Computes the arctangent of the column values.
|
|
108
162
|
* @returns ColumnExpression
|
|
109
163
|
* @example
|
|
110
|
-
|
|
111
|
-
|
|
164
|
+
* >>> const df = $df.data({ a: [1, 2, 3] })
|
|
165
|
+
* >>> df
|
|
166
|
+
* shape: (3, 1)
|
|
167
|
+
* ┌───┐
|
|
168
|
+
* │ a │
|
|
169
|
+
* ├───┤
|
|
170
|
+
* │ 1 │
|
|
171
|
+
* │ 2 │
|
|
172
|
+
* │ 3 │
|
|
173
|
+
* └───┘
|
|
174
|
+
* >>> df.withColumns($df.col("a").atan().alias("atan_a"))
|
|
112
175
|
* shape: (3, 2)
|
|
113
|
-
*
|
|
114
|
-
* │ a │ atan_a
|
|
115
|
-
*
|
|
116
|
-
* │
|
|
117
|
-
* │
|
|
118
|
-
* │
|
|
119
|
-
*
|
|
176
|
+
* ┌───┬──────────┐
|
|
177
|
+
* │ a │ atan_a │
|
|
178
|
+
* ├───┼──────────┤
|
|
179
|
+
* │ 1 │ 0.785398 │
|
|
180
|
+
* │ 2 │ 1.107149 │
|
|
181
|
+
* │ 3 │ 1.249046 │
|
|
182
|
+
* └───┴──────────┘
|
|
120
183
|
*/
|
|
121
184
|
atan(): this;
|
|
122
185
|
/**
|
|
@@ -124,62 +187,100 @@ export declare class ArithmeticExpr extends ExprBase {
|
|
|
124
187
|
* @param val The x denominator number or column expression.
|
|
125
188
|
* @returns ColumnExpression
|
|
126
189
|
* @example
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
190
|
+
* >>> const df = $df.data({ a: [1, 2, 3], b: [10, 20, 30] })
|
|
191
|
+
* >>> df
|
|
192
|
+
* shape: (3, 2)
|
|
193
|
+
* ┌───┬────┐
|
|
194
|
+
* │ a │ b │
|
|
195
|
+
* ├───┼────┤
|
|
196
|
+
* │ 1 │ 10 │
|
|
197
|
+
* │ 2 │ 20 │
|
|
198
|
+
* │ 3 │ 30 │
|
|
199
|
+
* └───┴────┘
|
|
200
|
+
* >>> df.withColumns($df.col("a").atan2($df.col("b")).alias("atan2_a"))
|
|
201
|
+
* shape: (3, 3)
|
|
202
|
+
* ┌───┬────┬──────────┐
|
|
203
|
+
* │ a │ b │ atan2_a │
|
|
204
|
+
* ├───┼────┼──────────┤
|
|
205
|
+
* │ 1 │ 10 │ 0.099669 │
|
|
206
|
+
* │ 2 │ 20 │ 0.099669 │
|
|
207
|
+
* │ 3 │ 30 │ 0.099669 │
|
|
208
|
+
* └───┴────┴──────────┘
|
|
136
209
|
*/
|
|
137
210
|
atan2(val: NumericArg): this;
|
|
138
211
|
/**
|
|
139
212
|
* Computes the hyperbolic arctangent of the column values.
|
|
140
213
|
* @returns ColumnExpression
|
|
141
214
|
* @example
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
215
|
+
* >>> const df = $df.data({ a: [1, 2, 3] })
|
|
216
|
+
* >>> df
|
|
217
|
+
* shape: (3, 1)
|
|
218
|
+
* ┌───┐
|
|
219
|
+
* │ a │
|
|
220
|
+
* ├───┤
|
|
221
|
+
* │ 1 │
|
|
222
|
+
* │ 2 │
|
|
223
|
+
* │ 3 │
|
|
224
|
+
* └───┘
|
|
225
|
+
* >>> df.withColumns($df.col("a").atanh().alias("atanh_a"))
|
|
226
|
+
* shape: (3, 2)
|
|
227
|
+
* ┌───┬─────────┐
|
|
228
|
+
* │ a │ atanh_a │
|
|
229
|
+
* ├───┼─────────┤
|
|
230
|
+
* │ 1 │ null │
|
|
231
|
+
* │ 2 │ null │
|
|
232
|
+
* │ 3 │ null │
|
|
233
|
+
* └───┴─────────┘
|
|
151
234
|
*/
|
|
152
235
|
atanh(): this;
|
|
153
236
|
/**
|
|
154
237
|
* Computes the cube root of the column values.
|
|
155
238
|
* @returns ColumnExpression
|
|
156
239
|
* @example
|
|
157
|
-
|
|
158
|
-
|
|
240
|
+
* >>> const df = $df.data({ a: [1, 2, 3] })
|
|
241
|
+
* >>> df
|
|
242
|
+
* shape: (3, 1)
|
|
243
|
+
* ┌───┐
|
|
244
|
+
* │ a │
|
|
245
|
+
* ├───┤
|
|
246
|
+
* │ 1 │
|
|
247
|
+
* │ 2 │
|
|
248
|
+
* │ 3 │
|
|
249
|
+
* └───┘
|
|
250
|
+
* >>> df.withColumns($df.col("a").cbrt().alias("cbrt_a"))
|
|
159
251
|
* shape: (3, 2)
|
|
160
|
-
*
|
|
161
|
-
* │ a
|
|
162
|
-
*
|
|
163
|
-
* │ 1
|
|
164
|
-
* │
|
|
165
|
-
* │
|
|
166
|
-
*
|
|
252
|
+
* ┌───┬──────────┐
|
|
253
|
+
* │ a │ cbrt_a │
|
|
254
|
+
* ├───┼──────────┤
|
|
255
|
+
* │ 1 │ 1 │
|
|
256
|
+
* │ 2 │ 1.259921 │
|
|
257
|
+
* │ 3 │ 1.44225 │
|
|
258
|
+
* └───┴──────────┘
|
|
167
259
|
*/
|
|
168
260
|
cbrt(): this;
|
|
169
261
|
/**
|
|
170
262
|
* Rounds column values up to the nearest integer.
|
|
171
263
|
* @returns ColumnExpression
|
|
172
264
|
* @example
|
|
173
|
-
|
|
174
|
-
|
|
265
|
+
* >>> const df = $df.data({ a: [1, 2, 3] })
|
|
266
|
+
* >>> df
|
|
267
|
+
* shape: (3, 1)
|
|
268
|
+
* ┌───┐
|
|
269
|
+
* │ a │
|
|
270
|
+
* ├───┤
|
|
271
|
+
* │ 1 │
|
|
272
|
+
* │ 2 │
|
|
273
|
+
* │ 3 │
|
|
274
|
+
* └───┘
|
|
275
|
+
* >>> df.withColumns($df.col("a").ceil().alias("ceil_a"))
|
|
175
276
|
* shape: (3, 2)
|
|
176
|
-
*
|
|
177
|
-
* │ a
|
|
178
|
-
*
|
|
179
|
-
* │ 1
|
|
180
|
-
* │ 2
|
|
181
|
-
* │
|
|
182
|
-
*
|
|
277
|
+
* ┌───┬────────┐
|
|
278
|
+
* │ a │ ceil_a │
|
|
279
|
+
* ├───┼────────┤
|
|
280
|
+
* │ 1 │ 1 │
|
|
281
|
+
* │ 2 │ 2 │
|
|
282
|
+
* │ 3 │ 3 │
|
|
283
|
+
* └───┴────────┘
|
|
183
284
|
*/
|
|
184
285
|
ceil(): this;
|
|
185
286
|
/**
|
|
@@ -188,16 +289,25 @@ export declare class ArithmeticExpr extends ExprBase {
|
|
|
188
289
|
* @param upper The upper threshold value (default: null).
|
|
189
290
|
* @returns ColumnExpression
|
|
190
291
|
* @example
|
|
191
|
-
|
|
192
|
-
|
|
292
|
+
* >>> const df = $df.data({ a: [1, 2, 3] })
|
|
293
|
+
* >>> df
|
|
294
|
+
* shape: (3, 1)
|
|
295
|
+
* ┌───┐
|
|
296
|
+
* │ a │
|
|
297
|
+
* ├───┤
|
|
298
|
+
* │ 1 │
|
|
299
|
+
* │ 2 │
|
|
300
|
+
* │ 3 │
|
|
301
|
+
* └───┘
|
|
302
|
+
* >>> df.withColumns($df.col("a").clip(2, 3).alias("clipped"))
|
|
193
303
|
* shape: (3, 2)
|
|
194
|
-
*
|
|
195
|
-
* │ a
|
|
196
|
-
*
|
|
197
|
-
* │
|
|
198
|
-
* │
|
|
199
|
-
* │
|
|
200
|
-
*
|
|
304
|
+
* ┌───┬─────────┐
|
|
305
|
+
* │ a │ clipped │
|
|
306
|
+
* ├───┼─────────┤
|
|
307
|
+
* │ 1 │ 2 │
|
|
308
|
+
* │ 2 │ 2 │
|
|
309
|
+
* │ 3 │ 3 │
|
|
310
|
+
* └───┴─────────┘
|
|
201
311
|
*/
|
|
202
312
|
clip(lower?: number | null, upper?: number | null): this;
|
|
203
313
|
/**
|
|
@@ -205,44 +315,74 @@ export declare class ArithmeticExpr extends ExprBase {
|
|
|
205
315
|
* @param val The sign source value or column expression.
|
|
206
316
|
* @returns ColumnExpression
|
|
207
317
|
* @example
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
318
|
+
* >>> const df = $df.data({ a: [1, 2, 3], b: [10, 20, 30] })
|
|
319
|
+
* >>> df
|
|
320
|
+
* shape: (3, 2)
|
|
321
|
+
* ┌───┬────┐
|
|
322
|
+
* │ a │ b │
|
|
323
|
+
* ├───┼────┤
|
|
324
|
+
* │ 1 │ 10 │
|
|
325
|
+
* │ 2 │ 20 │
|
|
326
|
+
* │ 3 │ 30 │
|
|
327
|
+
* └───┴────┘
|
|
328
|
+
* >>> df.withColumns($df.col("a").copysign($df.col("b")).alias("signed"))
|
|
329
|
+
* shape: (3, 3)
|
|
330
|
+
* ┌───┬────┬────────┐
|
|
331
|
+
* │ a │ b │ signed │
|
|
332
|
+
* ├───┼────┼────────┤
|
|
333
|
+
* │ 1 │ 10 │ 1 │
|
|
334
|
+
* │ 2 │ 20 │ 2 │
|
|
335
|
+
* │ 3 │ 30 │ 3 │
|
|
336
|
+
* └───┴────┴────────┘
|
|
217
337
|
*/
|
|
218
338
|
copysign(val: NumericArg): this;
|
|
219
339
|
/**
|
|
220
340
|
* Computes the cosine of the column values.
|
|
221
341
|
* @returns ColumnExpression
|
|
222
342
|
* @example
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
343
|
+
* >>> const df = $df.data({ a: [1, 2, 3] })
|
|
344
|
+
* >>> df
|
|
345
|
+
* shape: (3, 1)
|
|
346
|
+
* ┌───┐
|
|
347
|
+
* │ a │
|
|
348
|
+
* ├───┤
|
|
349
|
+
* │ 1 │
|
|
350
|
+
* │ 2 │
|
|
351
|
+
* │ 3 │
|
|
352
|
+
* └───┘
|
|
353
|
+
* >>> df.withColumns($df.col("a").cos().alias("cos_a"))
|
|
354
|
+
* shape: (3, 2)
|
|
355
|
+
* ┌───┬───────────┐
|
|
356
|
+
* │ a │ cos_a │
|
|
357
|
+
* ├───┼───────────┤
|
|
358
|
+
* │ 1 │ 0.540302 │
|
|
359
|
+
* │ 2 │ -0.416147 │
|
|
360
|
+
* │ 3 │ -0.989992 │
|
|
361
|
+
* └───┴───────────┘
|
|
232
362
|
*/
|
|
233
363
|
cos(): this;
|
|
234
364
|
/**
|
|
235
365
|
* Computes the hyperbolic cosine of the column values.
|
|
236
366
|
* @returns ColumnExpression
|
|
237
367
|
* @example
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
368
|
+
* >>> const df = $df.data({ a: [1, 2, 3] })
|
|
369
|
+
* >>> df
|
|
370
|
+
* shape: (3, 1)
|
|
371
|
+
* ┌───┐
|
|
372
|
+
* │ a │
|
|
373
|
+
* ├───┤
|
|
374
|
+
* │ 1 │
|
|
375
|
+
* │ 2 │
|
|
376
|
+
* │ 3 │
|
|
377
|
+
* └───┘
|
|
378
|
+
* >>> df.withColumns($df.col("a").cosh().alias("cosh_a"))
|
|
379
|
+
* shape: (3, 2)
|
|
241
380
|
* ┌───┬───────────┐
|
|
242
381
|
* │ a │ cosh_a │
|
|
243
382
|
* ├───┼───────────┤
|
|
244
|
-
* │
|
|
245
|
-
* │
|
|
383
|
+
* │ 1 │ 1.543081 │
|
|
384
|
+
* │ 2 │ 3.762196 │
|
|
385
|
+
* │ 3 │ 10.067662 │
|
|
246
386
|
* └───┴───────────┘
|
|
247
387
|
*/
|
|
248
388
|
cosh(): this;
|
|
@@ -250,15 +390,25 @@ export declare class ArithmeticExpr extends ExprBase {
|
|
|
250
390
|
* Converts angles from radians to degrees.
|
|
251
391
|
* @returns ColumnExpression
|
|
252
392
|
* @example
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
393
|
+
* >>> const df = $df.data({ a: [1, 2, 3] })
|
|
394
|
+
* >>> df
|
|
395
|
+
* shape: (3, 1)
|
|
396
|
+
* ┌───┐
|
|
397
|
+
* │ a │
|
|
398
|
+
* ├───┤
|
|
399
|
+
* │ 1 │
|
|
400
|
+
* │ 2 │
|
|
401
|
+
* │ 3 │
|
|
402
|
+
* └───┘
|
|
403
|
+
* >>> df.withColumns($df.col("a").degrees().alias("deg"))
|
|
404
|
+
* shape: (3, 2)
|
|
405
|
+
* ┌───┬────────────┐
|
|
406
|
+
* │ a │ deg │
|
|
407
|
+
* ├───┼────────────┤
|
|
408
|
+
* │ 1 │ 57.29578 │
|
|
409
|
+
* │ 2 │ 114.591559 │
|
|
410
|
+
* │ 3 │ 171.887339 │
|
|
411
|
+
* └───┴────────────┘
|
|
262
412
|
*/
|
|
263
413
|
degrees(): this;
|
|
264
414
|
/**
|
|
@@ -266,64 +416,100 @@ export declare class ArithmeticExpr extends ExprBase {
|
|
|
266
416
|
* @param val The denominator value or column expression.
|
|
267
417
|
* @returns ColumnExpression
|
|
268
418
|
* @example
|
|
269
|
-
|
|
270
|
-
|
|
419
|
+
* >>> const df = $df.data({ a: [1, 2, 3] })
|
|
420
|
+
* >>> df
|
|
421
|
+
* shape: (3, 1)
|
|
422
|
+
* ┌───┐
|
|
423
|
+
* │ a │
|
|
424
|
+
* ├───┤
|
|
425
|
+
* │ 1 │
|
|
426
|
+
* │ 2 │
|
|
427
|
+
* │ 3 │
|
|
428
|
+
* └───┘
|
|
429
|
+
* >>> df.withColumns($df.col("a").div(2).alias("div_a"))
|
|
271
430
|
* shape: (3, 2)
|
|
272
|
-
*
|
|
273
|
-
* │ a
|
|
274
|
-
*
|
|
275
|
-
* │
|
|
276
|
-
* │
|
|
277
|
-
* │
|
|
278
|
-
*
|
|
431
|
+
* ┌───┬───────┐
|
|
432
|
+
* │ a │ div_a │
|
|
433
|
+
* ├───┼───────┤
|
|
434
|
+
* │ 1 │ 0.5 │
|
|
435
|
+
* │ 2 │ 1 │
|
|
436
|
+
* │ 3 │ 1.5 │
|
|
437
|
+
* └───┴───────┘
|
|
279
438
|
*/
|
|
280
439
|
div(val: NumericArg): this;
|
|
281
440
|
/**
|
|
282
441
|
* Computes natural exponent (e^x) of the column values.
|
|
283
442
|
* @returns ColumnExpression
|
|
284
443
|
* @example
|
|
285
|
-
|
|
286
|
-
|
|
444
|
+
* >>> const df = $df.data({ a: [1, 2, 3] })
|
|
445
|
+
* >>> df
|
|
446
|
+
* shape: (3, 1)
|
|
447
|
+
* ┌───┐
|
|
448
|
+
* │ a │
|
|
449
|
+
* ├───┤
|
|
450
|
+
* │ 1 │
|
|
451
|
+
* │ 2 │
|
|
452
|
+
* │ 3 │
|
|
453
|
+
* └───┘
|
|
454
|
+
* >>> df.withColumns($df.col("a").exp().alias("exp_a"))
|
|
287
455
|
* shape: (3, 2)
|
|
288
|
-
*
|
|
289
|
-
* │ a │ exp_a
|
|
290
|
-
*
|
|
291
|
-
* │
|
|
292
|
-
* │
|
|
293
|
-
* │
|
|
294
|
-
*
|
|
456
|
+
* ┌───┬───────────┐
|
|
457
|
+
* │ a │ exp_a │
|
|
458
|
+
* ├───┼───────────┤
|
|
459
|
+
* │ 1 │ 2.718282 │
|
|
460
|
+
* │ 2 │ 7.389056 │
|
|
461
|
+
* │ 3 │ 20.085537 │
|
|
462
|
+
* └───┴───────────┘
|
|
295
463
|
*/
|
|
296
464
|
exp(): this;
|
|
297
465
|
/**
|
|
298
466
|
* Computes e^x - 1 for each element in the column.
|
|
299
467
|
* @returns ColumnExpression
|
|
300
468
|
* @example
|
|
301
|
-
|
|
302
|
-
|
|
469
|
+
* >>> const df = $df.data({ a: [1, 2, 3] })
|
|
470
|
+
* >>> df
|
|
471
|
+
* shape: (3, 1)
|
|
472
|
+
* ┌───┐
|
|
473
|
+
* │ a │
|
|
474
|
+
* ├───┤
|
|
475
|
+
* │ 1 │
|
|
476
|
+
* │ 2 │
|
|
477
|
+
* │ 3 │
|
|
478
|
+
* └───┘
|
|
479
|
+
* >>> df.withColumns($df.col("a").expm1().alias("expm1_a"))
|
|
303
480
|
* shape: (3, 2)
|
|
304
|
-
*
|
|
305
|
-
* │ a │ expm1_a
|
|
306
|
-
*
|
|
307
|
-
* │
|
|
308
|
-
* │
|
|
309
|
-
* │
|
|
310
|
-
*
|
|
481
|
+
* ┌───┬───────────┐
|
|
482
|
+
* │ a │ expm1_a │
|
|
483
|
+
* ├───┼───────────┤
|
|
484
|
+
* │ 1 │ 1.718282 │
|
|
485
|
+
* │ 2 │ 6.389056 │
|
|
486
|
+
* │ 3 │ 19.085537 │
|
|
487
|
+
* └───┴───────────┘
|
|
311
488
|
*/
|
|
312
489
|
expm1(): this;
|
|
313
490
|
/**
|
|
314
491
|
* Rounds column values down to the nearest integer.
|
|
315
492
|
* @returns ColumnExpression
|
|
316
493
|
* @example
|
|
317
|
-
|
|
318
|
-
|
|
494
|
+
* >>> const df = $df.data({ a: [1, 2, 3] })
|
|
495
|
+
* >>> df
|
|
496
|
+
* shape: (3, 1)
|
|
497
|
+
* ┌───┐
|
|
498
|
+
* │ a │
|
|
499
|
+
* ├───┤
|
|
500
|
+
* │ 1 │
|
|
501
|
+
* │ 2 │
|
|
502
|
+
* │ 3 │
|
|
503
|
+
* └───┘
|
|
504
|
+
* >>> df.withColumns($df.col("a").floor().alias("floor_a"))
|
|
319
505
|
* shape: (3, 2)
|
|
320
|
-
*
|
|
321
|
-
* │ a
|
|
322
|
-
*
|
|
323
|
-
* │ 1
|
|
324
|
-
* │ 2
|
|
325
|
-
* │
|
|
326
|
-
*
|
|
506
|
+
* ┌───┬─────────┐
|
|
507
|
+
* │ a │ floor_a │
|
|
508
|
+
* ├───┼─────────┤
|
|
509
|
+
* │ 1 │ 1 │
|
|
510
|
+
* │ 2 │ 2 │
|
|
511
|
+
* │ 3 │ 3 │
|
|
512
|
+
* └───┴─────────┘
|
|
327
513
|
*/
|
|
328
514
|
floor(): this;
|
|
329
515
|
/**
|
|
@@ -331,16 +517,25 @@ export declare class ArithmeticExpr extends ExprBase {
|
|
|
331
517
|
* @param val The divisor value or column expression.
|
|
332
518
|
* @returns ColumnExpression
|
|
333
519
|
* @example
|
|
334
|
-
|
|
335
|
-
|
|
520
|
+
* >>> const df = $df.data({ a: [1, 2, 3] })
|
|
521
|
+
* >>> df
|
|
522
|
+
* shape: (3, 1)
|
|
523
|
+
* ┌───┐
|
|
524
|
+
* │ a │
|
|
525
|
+
* ├───┤
|
|
526
|
+
* │ 1 │
|
|
527
|
+
* │ 2 │
|
|
528
|
+
* │ 3 │
|
|
529
|
+
* └───┘
|
|
530
|
+
* >>> df.withColumns($df.col("a").floordiv(2).alias("fdiv"))
|
|
336
531
|
* shape: (3, 2)
|
|
337
|
-
*
|
|
338
|
-
* │ a
|
|
339
|
-
*
|
|
340
|
-
* │
|
|
341
|
-
* │
|
|
342
|
-
* │
|
|
343
|
-
*
|
|
532
|
+
* ┌───┬──────┐
|
|
533
|
+
* │ a │ fdiv │
|
|
534
|
+
* ├───┼──────┤
|
|
535
|
+
* │ 1 │ 0 │
|
|
536
|
+
* │ 2 │ 1 │
|
|
537
|
+
* │ 3 │ 1 │
|
|
538
|
+
* └───┴──────┘
|
|
344
539
|
*/
|
|
345
540
|
floordiv(val: NumericArg): this;
|
|
346
541
|
/**
|
|
@@ -348,15 +543,25 @@ export declare class ArithmeticExpr extends ExprBase {
|
|
|
348
543
|
* @param val The other numeric value or column expression.
|
|
349
544
|
* @returns ColumnExpression
|
|
350
545
|
* @example
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
546
|
+
* >>> const df = $df.data({ a: [1, 2, 3], b: [10, 20, 30] })
|
|
547
|
+
* >>> df
|
|
548
|
+
* shape: (3, 2)
|
|
549
|
+
* ┌───┬────┐
|
|
550
|
+
* │ a │ b │
|
|
551
|
+
* ├───┼────┤
|
|
552
|
+
* │ 1 │ 10 │
|
|
553
|
+
* │ 2 │ 20 │
|
|
554
|
+
* │ 3 │ 30 │
|
|
555
|
+
* └───┴────┘
|
|
556
|
+
* >>> df.withColumns($df.col("a").hypot($df.col("b")).alias("hypot_a"))
|
|
557
|
+
* shape: (3, 3)
|
|
558
|
+
* ┌───┬────┬───────────┐
|
|
559
|
+
* │ a │ b │ hypot_a │
|
|
560
|
+
* ├───┼────┼───────────┤
|
|
561
|
+
* │ 1 │ 10 │ 10.049876 │
|
|
562
|
+
* │ 2 │ 20 │ 20.099751 │
|
|
563
|
+
* │ 3 │ 30 │ 30.149627 │
|
|
564
|
+
* └───┴────┴───────────┘
|
|
360
565
|
*/
|
|
361
566
|
hypot(val: NumericArg): this;
|
|
362
567
|
/**
|
|
@@ -364,31 +569,49 @@ export declare class ArithmeticExpr extends ExprBase {
|
|
|
364
569
|
* @param base The base of the logarithm (default: Math.E).
|
|
365
570
|
* @returns ColumnExpression
|
|
366
571
|
* @example
|
|
367
|
-
|
|
368
|
-
|
|
572
|
+
* >>> const df = $df.data({ a: [1, 2, 3] })
|
|
573
|
+
* >>> df
|
|
574
|
+
* shape: (3, 1)
|
|
575
|
+
* ┌───┐
|
|
576
|
+
* │ a │
|
|
577
|
+
* ├───┤
|
|
578
|
+
* │ 1 │
|
|
579
|
+
* │ 2 │
|
|
580
|
+
* │ 3 │
|
|
581
|
+
* └───┘
|
|
582
|
+
* >>> df.withColumns($df.col("a").log(10).alias("log_a"))
|
|
369
583
|
* shape: (3, 2)
|
|
370
|
-
*
|
|
371
|
-
* │ a
|
|
372
|
-
*
|
|
373
|
-
* │ 1
|
|
374
|
-
* │
|
|
375
|
-
* │
|
|
376
|
-
*
|
|
584
|
+
* ┌───┬──────────┐
|
|
585
|
+
* │ a │ log_a │
|
|
586
|
+
* ├───┼──────────┤
|
|
587
|
+
* │ 1 │ 0 │
|
|
588
|
+
* │ 2 │ 0.30103 │
|
|
589
|
+
* │ 3 │ 0.477121 │
|
|
590
|
+
* └───┴──────────┘
|
|
377
591
|
*/
|
|
378
592
|
log(base?: number): this;
|
|
379
593
|
/**
|
|
380
594
|
* Computes natural logarithm of 1 + x.
|
|
381
595
|
* @returns ColumnExpression
|
|
382
596
|
* @example
|
|
383
|
-
|
|
384
|
-
|
|
597
|
+
* >>> const df = $df.data({ a: [1, 2, 3] })
|
|
598
|
+
* >>> df
|
|
599
|
+
* shape: (3, 1)
|
|
600
|
+
* ┌───┐
|
|
601
|
+
* │ a │
|
|
602
|
+
* ├───┤
|
|
603
|
+
* │ 1 │
|
|
604
|
+
* │ 2 │
|
|
605
|
+
* │ 3 │
|
|
606
|
+
* └───┘
|
|
607
|
+
* >>> df.withColumns($df.col("a").log1p().alias("log1p_a"))
|
|
385
608
|
* shape: (3, 2)
|
|
386
609
|
* ┌───┬──────────┐
|
|
387
610
|
* │ a │ log1p_a │
|
|
388
611
|
* ├───┼──────────┤
|
|
389
|
-
* │ 0 │ 0 │
|
|
390
612
|
* │ 1 │ 0.693147 │
|
|
391
613
|
* │ 2 │ 1.098612 │
|
|
614
|
+
* │ 3 │ 1.386294 │
|
|
392
615
|
* └───┴──────────┘
|
|
393
616
|
*/
|
|
394
617
|
log1p(): this;
|
|
@@ -397,16 +620,25 @@ export declare class ArithmeticExpr extends ExprBase {
|
|
|
397
620
|
* @param val The divisor value or column expression.
|
|
398
621
|
* @returns ColumnExpression
|
|
399
622
|
* @example
|
|
400
|
-
|
|
401
|
-
|
|
623
|
+
* >>> const df = $df.data({ a: [1, 2, 3] })
|
|
624
|
+
* >>> df
|
|
625
|
+
* shape: (3, 1)
|
|
626
|
+
* ┌───┐
|
|
627
|
+
* │ a │
|
|
628
|
+
* ├───┤
|
|
629
|
+
* │ 1 │
|
|
630
|
+
* │ 2 │
|
|
631
|
+
* │ 3 │
|
|
632
|
+
* └───┘
|
|
633
|
+
* >>> df.withColumns($df.col("a").mod(2).alias("mod_a"))
|
|
402
634
|
* shape: (3, 2)
|
|
403
|
-
*
|
|
404
|
-
* │ a
|
|
405
|
-
*
|
|
406
|
-
* │
|
|
407
|
-
* │
|
|
408
|
-
* │
|
|
409
|
-
*
|
|
635
|
+
* ┌───┬───────┐
|
|
636
|
+
* │ a │ mod_a │
|
|
637
|
+
* ├───┼───────┤
|
|
638
|
+
* │ 1 │ 1 │
|
|
639
|
+
* │ 2 │ 0 │
|
|
640
|
+
* │ 3 │ 1 │
|
|
641
|
+
* └───┴───────┘
|
|
410
642
|
*/
|
|
411
643
|
mod(val: NumericArg): this;
|
|
412
644
|
/**
|
|
@@ -414,8 +646,17 @@ export declare class ArithmeticExpr extends ExprBase {
|
|
|
414
646
|
* @param val The multiplier value or column expression.
|
|
415
647
|
* @returns ColumnExpression
|
|
416
648
|
* @example
|
|
417
|
-
|
|
418
|
-
|
|
649
|
+
* >>> const df = $df.data({ a: [1, 2, 3] })
|
|
650
|
+
* >>> df
|
|
651
|
+
* shape: (3, 1)
|
|
652
|
+
* ┌───┐
|
|
653
|
+
* │ a │
|
|
654
|
+
* ├───┤
|
|
655
|
+
* │ 1 │
|
|
656
|
+
* │ 2 │
|
|
657
|
+
* │ 3 │
|
|
658
|
+
* └───┘
|
|
659
|
+
* >>> df.withColumns($df.col("a").mul(5).alias("multiplied"))
|
|
419
660
|
* shape: (3, 2)
|
|
420
661
|
* ┌───┬────────────┐
|
|
421
662
|
* │ a │ multiplied │
|
|
@@ -430,16 +671,25 @@ export declare class ArithmeticExpr extends ExprBase {
|
|
|
430
671
|
* Negates column values (-x).
|
|
431
672
|
* @returns ColumnExpression
|
|
432
673
|
* @example
|
|
433
|
-
|
|
434
|
-
|
|
674
|
+
* >>> const df = $df.data({ a: [1, 2, 3] })
|
|
675
|
+
* >>> df
|
|
676
|
+
* shape: (3, 1)
|
|
677
|
+
* ┌───┐
|
|
678
|
+
* │ a │
|
|
679
|
+
* ├───┤
|
|
680
|
+
* │ 1 │
|
|
681
|
+
* │ 2 │
|
|
682
|
+
* │ 3 │
|
|
683
|
+
* └───┘
|
|
684
|
+
* >>> df.withColumns($df.col("a").negate().alias("negated"))
|
|
435
685
|
* shape: (3, 2)
|
|
436
|
-
*
|
|
437
|
-
* │ a
|
|
438
|
-
*
|
|
439
|
-
* │ 1
|
|
440
|
-
* │
|
|
441
|
-
* │ 3
|
|
442
|
-
*
|
|
686
|
+
* ┌───┬─────────┐
|
|
687
|
+
* │ a │ negated │
|
|
688
|
+
* ├───┼─────────┤
|
|
689
|
+
* │ 1 │ -1 │
|
|
690
|
+
* │ 2 │ -2 │
|
|
691
|
+
* │ 3 │ -3 │
|
|
692
|
+
* └───┴─────────┘
|
|
443
693
|
*/
|
|
444
694
|
negate(): this;
|
|
445
695
|
/**
|
|
@@ -447,15 +697,24 @@ export declare class ArithmeticExpr extends ExprBase {
|
|
|
447
697
|
* @param val The exponent power value or column expression.
|
|
448
698
|
* @returns ColumnExpression
|
|
449
699
|
* @example
|
|
450
|
-
|
|
451
|
-
|
|
700
|
+
* >>> const df = $df.data({ a: [1, 2, 3] })
|
|
701
|
+
* >>> df
|
|
702
|
+
* shape: (3, 1)
|
|
703
|
+
* ┌───┐
|
|
704
|
+
* │ a │
|
|
705
|
+
* ├───┤
|
|
706
|
+
* │ 1 │
|
|
707
|
+
* │ 2 │
|
|
708
|
+
* │ 3 │
|
|
709
|
+
* └───┘
|
|
710
|
+
* >>> df.withColumns($df.col("a").pow(2).alias("pow_a"))
|
|
452
711
|
* shape: (3, 2)
|
|
453
712
|
* ┌───┬───────┐
|
|
454
713
|
* │ a │ pow_a │
|
|
455
714
|
* ├───┼───────┤
|
|
715
|
+
* │ 1 │ 1 │
|
|
456
716
|
* │ 2 │ 4 │
|
|
457
717
|
* │ 3 │ 9 │
|
|
458
|
-
* │ 4 │ 16 │
|
|
459
718
|
* └───┴───────┘
|
|
460
719
|
*/
|
|
461
720
|
pow(val: NumericArg): this;
|
|
@@ -463,15 +722,25 @@ export declare class ArithmeticExpr extends ExprBase {
|
|
|
463
722
|
* Converts angles from degrees to radians.
|
|
464
723
|
* @returns ColumnExpression
|
|
465
724
|
* @example
|
|
466
|
-
|
|
467
|
-
|
|
468
|
-
|
|
469
|
-
|
|
470
|
-
|
|
471
|
-
|
|
472
|
-
|
|
473
|
-
|
|
474
|
-
|
|
725
|
+
* >>> const df = $df.data({ a: [1, 2, 3] })
|
|
726
|
+
* >>> df
|
|
727
|
+
* shape: (3, 1)
|
|
728
|
+
* ┌───┐
|
|
729
|
+
* │ a │
|
|
730
|
+
* ├───┤
|
|
731
|
+
* │ 1 │
|
|
732
|
+
* │ 2 │
|
|
733
|
+
* │ 3 │
|
|
734
|
+
* └───┘
|
|
735
|
+
* >>> df.withColumns($df.col("a").radians().alias("rad"))
|
|
736
|
+
* shape: (3, 2)
|
|
737
|
+
* ┌───┬──────────┐
|
|
738
|
+
* │ a │ rad │
|
|
739
|
+
* ├───┼──────────┤
|
|
740
|
+
* │ 1 │ 0.017453 │
|
|
741
|
+
* │ 2 │ 0.034907 │
|
|
742
|
+
* │ 3 │ 0.05236 │
|
|
743
|
+
* └───┴──────────┘
|
|
475
744
|
*/
|
|
476
745
|
radians(): this;
|
|
477
746
|
/**
|
|
@@ -480,16 +749,25 @@ export declare class ArithmeticExpr extends ExprBase {
|
|
|
480
749
|
* @param options Config options including min, max, and integer flag.
|
|
481
750
|
* @returns ColumnExpression
|
|
482
751
|
* @example
|
|
483
|
-
|
|
484
|
-
|
|
752
|
+
* >>> const df = $df.data({ a: [1, 2, 3] })
|
|
753
|
+
* >>> df
|
|
754
|
+
* shape: (3, 1)
|
|
755
|
+
* ┌───┐
|
|
756
|
+
* │ a │
|
|
757
|
+
* ├───┤
|
|
758
|
+
* │ 1 │
|
|
759
|
+
* │ 2 │
|
|
760
|
+
* │ 3 │
|
|
761
|
+
* └───┘
|
|
762
|
+
* >>> df.withColumns($df.col("a").rand(42, { min: 1, max: 10, integer: true }).alias("random"))
|
|
485
763
|
* shape: (3, 2)
|
|
486
|
-
*
|
|
487
|
-
* │
|
|
488
|
-
*
|
|
489
|
-
* │ 1
|
|
490
|
-
* │ 2
|
|
491
|
-
* │ 3
|
|
492
|
-
*
|
|
764
|
+
* ┌───┬────────┐
|
|
765
|
+
* │ a │ random │
|
|
766
|
+
* ├───┼────────┤
|
|
767
|
+
* │ 1 │ 7 │
|
|
768
|
+
* │ 2 │ 8 │
|
|
769
|
+
* │ 3 │ 6 │
|
|
770
|
+
* └───┴────────┘
|
|
493
771
|
*/
|
|
494
772
|
rand(seed?: number, { min, max, integer }?: RandomOptions): this;
|
|
495
773
|
/**
|
|
@@ -497,76 +775,125 @@ export declare class ArithmeticExpr extends ExprBase {
|
|
|
497
775
|
* @param decimals Number of decimal places to round to (default: 0).
|
|
498
776
|
* @returns ColumnExpression
|
|
499
777
|
* @example
|
|
500
|
-
|
|
501
|
-
|
|
502
|
-
|
|
503
|
-
|
|
504
|
-
|
|
505
|
-
|
|
506
|
-
|
|
507
|
-
|
|
508
|
-
|
|
778
|
+
* >>> const df = $df.data({ a: [1, 2, 3] })
|
|
779
|
+
* >>> df
|
|
780
|
+
* shape: (3, 1)
|
|
781
|
+
* ┌───┐
|
|
782
|
+
* │ a │
|
|
783
|
+
* ├───┤
|
|
784
|
+
* │ 1 │
|
|
785
|
+
* │ 2 │
|
|
786
|
+
* │ 3 │
|
|
787
|
+
* └───┘
|
|
788
|
+
* >>> df.withColumns($df.col("a").round(1).alias("rounded"))
|
|
789
|
+
* shape: (3, 2)
|
|
790
|
+
* ┌───┬─────────┐
|
|
791
|
+
* │ a │ rounded │
|
|
792
|
+
* ├───┼─────────┤
|
|
793
|
+
* │ 1 │ 1 │
|
|
794
|
+
* │ 2 │ 2 │
|
|
795
|
+
* │ 3 │ 3 │
|
|
796
|
+
* └───┴─────────┘
|
|
509
797
|
*/
|
|
510
798
|
round(decimals?: number): this;
|
|
511
799
|
/**
|
|
512
800
|
* Rounds values to a specific number of significant figures.
|
|
513
|
-
* @param
|
|
801
|
+
* @param sigFigs Number of significant figures.
|
|
514
802
|
* @returns ColumnExpression
|
|
515
803
|
* @example
|
|
516
|
-
|
|
517
|
-
|
|
518
|
-
|
|
519
|
-
|
|
520
|
-
|
|
521
|
-
|
|
522
|
-
|
|
523
|
-
|
|
524
|
-
|
|
804
|
+
* >>> const df = $df.data({ a: [1, 2, 3] })
|
|
805
|
+
* >>> df
|
|
806
|
+
* shape: (3, 1)
|
|
807
|
+
* ┌───┐
|
|
808
|
+
* │ a │
|
|
809
|
+
* ├───┤
|
|
810
|
+
* │ 1 │
|
|
811
|
+
* │ 2 │
|
|
812
|
+
* │ 3 │
|
|
813
|
+
* └───┘
|
|
814
|
+
* >>> df.withColumns($df.col("a").roundSigFigs(2).alias("sig_figs"))
|
|
815
|
+
* shape: (3, 2)
|
|
816
|
+
* ┌───┬──────────┐
|
|
817
|
+
* │ a │ sig_figs │
|
|
818
|
+
* ├───┼──────────┤
|
|
819
|
+
* │ 1 │ 1 │
|
|
820
|
+
* │ 2 │ 2 │
|
|
821
|
+
* │ 3 │ 3 │
|
|
822
|
+
* └───┴──────────┘
|
|
525
823
|
*/
|
|
526
|
-
|
|
824
|
+
roundSigFigs(sigFigs: number): this;
|
|
527
825
|
/**
|
|
528
826
|
* Returns sign indicator of column values (-1, 0, or 1).
|
|
529
827
|
* @returns ColumnExpression
|
|
530
828
|
* @example
|
|
531
|
-
|
|
532
|
-
|
|
829
|
+
* >>> const df = $df.data({ a: [1, 2, 3] })
|
|
830
|
+
* >>> df
|
|
831
|
+
* shape: (3, 1)
|
|
832
|
+
* ┌───┐
|
|
833
|
+
* │ a │
|
|
834
|
+
* ├───┤
|
|
835
|
+
* │ 1 │
|
|
836
|
+
* │ 2 │
|
|
837
|
+
* │ 3 │
|
|
838
|
+
* └───┘
|
|
839
|
+
* >>> df.withColumns($df.col("a").sign().alias("sign_a"))
|
|
533
840
|
* shape: (3, 2)
|
|
534
|
-
*
|
|
535
|
-
* │ a
|
|
536
|
-
*
|
|
537
|
-
* │
|
|
538
|
-
* │
|
|
539
|
-
* │
|
|
540
|
-
*
|
|
841
|
+
* ┌───┬────────┐
|
|
842
|
+
* │ a │ sign_a │
|
|
843
|
+
* ├───┼────────┤
|
|
844
|
+
* │ 1 │ 1 │
|
|
845
|
+
* │ 2 │ 1 │
|
|
846
|
+
* │ 3 │ 1 │
|
|
847
|
+
* └───┴────────┘
|
|
541
848
|
*/
|
|
542
849
|
sign(): this;
|
|
543
850
|
/**
|
|
544
851
|
* Computes the sine of the column values.
|
|
545
852
|
* @returns ColumnExpression
|
|
546
853
|
* @example
|
|
547
|
-
|
|
548
|
-
|
|
549
|
-
|
|
550
|
-
|
|
551
|
-
|
|
552
|
-
|
|
553
|
-
|
|
554
|
-
|
|
555
|
-
|
|
854
|
+
* >>> const df = $df.data({ a: [1, 2, 3] })
|
|
855
|
+
* >>> df
|
|
856
|
+
* shape: (3, 1)
|
|
857
|
+
* ┌───┐
|
|
858
|
+
* │ a │
|
|
859
|
+
* ├───┤
|
|
860
|
+
* │ 1 │
|
|
861
|
+
* │ 2 │
|
|
862
|
+
* │ 3 │
|
|
863
|
+
* └───┘
|
|
864
|
+
* >>> df.withColumns($df.col("a").sin().alias("sin_a"))
|
|
865
|
+
* shape: (3, 2)
|
|
866
|
+
* ┌───┬──────────┐
|
|
867
|
+
* │ a │ sin_a │
|
|
868
|
+
* ├───┼──────────┤
|
|
869
|
+
* │ 1 │ 0.841471 │
|
|
870
|
+
* │ 2 │ 0.909297 │
|
|
871
|
+
* │ 3 │ 0.14112 │
|
|
872
|
+
* └───┴──────────┘
|
|
556
873
|
*/
|
|
557
874
|
sin(): this;
|
|
558
875
|
/**
|
|
559
876
|
* Computes the hyperbolic sine of the column values.
|
|
560
877
|
* @returns ColumnExpression
|
|
561
878
|
* @example
|
|
562
|
-
|
|
563
|
-
|
|
564
|
-
|
|
879
|
+
* >>> const df = $df.data({ a: [1, 2, 3] })
|
|
880
|
+
* >>> df
|
|
881
|
+
* shape: (3, 1)
|
|
882
|
+
* ┌───┐
|
|
883
|
+
* │ a │
|
|
884
|
+
* ├───┤
|
|
885
|
+
* │ 1 │
|
|
886
|
+
* │ 2 │
|
|
887
|
+
* │ 3 │
|
|
888
|
+
* └───┘
|
|
889
|
+
* >>> df.withColumns($df.col("a").sinh().alias("sinh_a"))
|
|
890
|
+
* shape: (3, 2)
|
|
565
891
|
* ┌───┬───────────┐
|
|
566
892
|
* │ a │ sinh_a │
|
|
567
893
|
* ├───┼───────────┤
|
|
568
|
-
* │ 0 │ 0 │
|
|
569
894
|
* │ 1 │ 1.175201 │
|
|
895
|
+
* │ 2 │ 3.62686 │
|
|
896
|
+
* │ 3 │ 10.017875 │
|
|
570
897
|
* └───┴───────────┘
|
|
571
898
|
*/
|
|
572
899
|
sinh(): this;
|
|
@@ -574,16 +901,25 @@ export declare class ArithmeticExpr extends ExprBase {
|
|
|
574
901
|
* Computes the square root of non-negative column values.
|
|
575
902
|
* @returns ColumnExpression
|
|
576
903
|
* @example
|
|
577
|
-
|
|
578
|
-
|
|
904
|
+
* >>> const df = $df.data({ a: [1, 2, 3] })
|
|
905
|
+
* >>> df
|
|
906
|
+
* shape: (3, 1)
|
|
907
|
+
* ┌───┐
|
|
908
|
+
* │ a │
|
|
909
|
+
* ├───┤
|
|
910
|
+
* │ 1 │
|
|
911
|
+
* │ 2 │
|
|
912
|
+
* │ 3 │
|
|
913
|
+
* └───┘
|
|
914
|
+
* >>> df.withColumns($df.col("a").sqrt().alias("sqrt_a"))
|
|
579
915
|
* shape: (3, 2)
|
|
580
|
-
*
|
|
581
|
-
* │ a
|
|
582
|
-
*
|
|
583
|
-
* │
|
|
584
|
-
* │
|
|
585
|
-
* │
|
|
586
|
-
*
|
|
916
|
+
* ┌───┬──────────┐
|
|
917
|
+
* │ a │ sqrt_a │
|
|
918
|
+
* ├───┼──────────┤
|
|
919
|
+
* │ 1 │ 1 │
|
|
920
|
+
* │ 2 │ 1.414214 │
|
|
921
|
+
* │ 3 │ 1.732051 │
|
|
922
|
+
* └───┴──────────┘
|
|
587
923
|
*/
|
|
588
924
|
sqrt(): this;
|
|
589
925
|
/**
|
|
@@ -591,62 +927,100 @@ export declare class ArithmeticExpr extends ExprBase {
|
|
|
591
927
|
* @param val The value or column expression to subtract.
|
|
592
928
|
* @returns ColumnExpression
|
|
593
929
|
* @example
|
|
594
|
-
|
|
595
|
-
|
|
930
|
+
* >>> const df = $df.data({ a: [1, 2, 3] })
|
|
931
|
+
* >>> df
|
|
932
|
+
* shape: (3, 1)
|
|
933
|
+
* ┌───┐
|
|
934
|
+
* │ a │
|
|
935
|
+
* ├───┤
|
|
936
|
+
* │ 1 │
|
|
937
|
+
* │ 2 │
|
|
938
|
+
* │ 3 │
|
|
939
|
+
* └───┘
|
|
940
|
+
* >>> df.withColumns($df.col("a").sub(5).alias("sub_a"))
|
|
596
941
|
* shape: (3, 2)
|
|
597
|
-
*
|
|
598
|
-
* │ a
|
|
599
|
-
*
|
|
600
|
-
* │
|
|
601
|
-
* │
|
|
602
|
-
* │
|
|
603
|
-
*
|
|
942
|
+
* ┌───┬───────┐
|
|
943
|
+
* │ a │ sub_a │
|
|
944
|
+
* ├───┼───────┤
|
|
945
|
+
* │ 1 │ -4 │
|
|
946
|
+
* │ 2 │ -3 │
|
|
947
|
+
* │ 3 │ -2 │
|
|
948
|
+
* └───┴───────┘
|
|
604
949
|
*/
|
|
605
950
|
sub(val: NumericArg): this;
|
|
606
951
|
/**
|
|
607
952
|
* Computes the tangent of the column values.
|
|
608
953
|
* @returns ColumnExpression
|
|
609
954
|
* @example
|
|
610
|
-
|
|
611
|
-
|
|
612
|
-
|
|
613
|
-
|
|
614
|
-
|
|
615
|
-
|
|
616
|
-
|
|
617
|
-
|
|
618
|
-
|
|
955
|
+
* >>> const df = $df.data({ a: [1, 2, 3] })
|
|
956
|
+
* >>> df
|
|
957
|
+
* shape: (3, 1)
|
|
958
|
+
* ┌───┐
|
|
959
|
+
* │ a │
|
|
960
|
+
* ├───┤
|
|
961
|
+
* │ 1 │
|
|
962
|
+
* │ 2 │
|
|
963
|
+
* │ 3 │
|
|
964
|
+
* └───┘
|
|
965
|
+
* >>> df.withColumns($df.col("a").tan().alias("tan_a"))
|
|
966
|
+
* shape: (3, 2)
|
|
967
|
+
* ┌───┬───────────┐
|
|
968
|
+
* │ a │ tan_a │
|
|
969
|
+
* ├───┼───────────┤
|
|
970
|
+
* │ 1 │ 1.557408 │
|
|
971
|
+
* │ 2 │ -2.18504 │
|
|
972
|
+
* │ 3 │ -0.142547 │
|
|
973
|
+
* └───┴───────────┘
|
|
619
974
|
*/
|
|
620
975
|
tan(): this;
|
|
621
976
|
/**
|
|
622
977
|
* Computes the hyperbolic tangent of the column values.
|
|
623
978
|
* @returns ColumnExpression
|
|
624
979
|
* @example
|
|
625
|
-
|
|
626
|
-
|
|
627
|
-
|
|
628
|
-
|
|
629
|
-
|
|
630
|
-
|
|
631
|
-
|
|
632
|
-
|
|
633
|
-
|
|
980
|
+
* >>> const df = $df.data({ a: [1, 2, 3] })
|
|
981
|
+
* >>> df
|
|
982
|
+
* shape: (3, 1)
|
|
983
|
+
* ┌───┐
|
|
984
|
+
* │ a │
|
|
985
|
+
* ├───┤
|
|
986
|
+
* │ 1 │
|
|
987
|
+
* │ 2 │
|
|
988
|
+
* │ 3 │
|
|
989
|
+
* └───┘
|
|
990
|
+
* >>> df.withColumns($df.col("a").tanh().alias("tanh_a"))
|
|
991
|
+
* shape: (3, 2)
|
|
992
|
+
* ┌───┬──────────┐
|
|
993
|
+
* │ a │ tanh_a │
|
|
994
|
+
* ├───┼──────────┤
|
|
995
|
+
* │ 1 │ 0.761594 │
|
|
996
|
+
* │ 2 │ 0.964028 │
|
|
997
|
+
* │ 3 │ 0.995055 │
|
|
998
|
+
* └───┴──────────┘
|
|
634
999
|
*/
|
|
635
1000
|
tanh(): this;
|
|
636
1001
|
/**
|
|
637
1002
|
* Truncates fractional digits of column values.
|
|
638
1003
|
* @returns ColumnExpression
|
|
639
1004
|
* @example
|
|
640
|
-
|
|
641
|
-
|
|
1005
|
+
* >>> const df = $df.data({ a: [1, 2, 3] })
|
|
1006
|
+
* >>> df
|
|
1007
|
+
* shape: (3, 1)
|
|
1008
|
+
* ┌───┐
|
|
1009
|
+
* │ a │
|
|
1010
|
+
* ├───┤
|
|
1011
|
+
* │ 1 │
|
|
1012
|
+
* │ 2 │
|
|
1013
|
+
* │ 3 │
|
|
1014
|
+
* └───┘
|
|
1015
|
+
* >>> df.withColumns($df.col("a").trunc().alias("trunc_a"))
|
|
642
1016
|
* shape: (3, 2)
|
|
643
|
-
*
|
|
644
|
-
* │ a
|
|
645
|
-
*
|
|
646
|
-
* │ 1
|
|
647
|
-
* │ 2
|
|
648
|
-
* │
|
|
649
|
-
*
|
|
1017
|
+
* ┌───┬─────────┐
|
|
1018
|
+
* │ a │ trunc_a │
|
|
1019
|
+
* ├───┼─────────┤
|
|
1020
|
+
* │ 1 │ 1 │
|
|
1021
|
+
* │ 2 │ 2 │
|
|
1022
|
+
* │ 3 │ 3 │
|
|
1023
|
+
* └───┴─────────┘
|
|
650
1024
|
*/
|
|
651
1025
|
trunc(): this;
|
|
652
1026
|
}
|