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,35 +12,43 @@ export declare class ComparisonExpr extends ExprBase {
|
|
|
12
12
|
* @param closed Control boundary inclusivity: "both", "left", "right", or "none" (default: "both").
|
|
13
13
|
* @returns ColumnExpression
|
|
14
14
|
* @example
|
|
15
|
-
|
|
15
|
+
* >>> const df = $df.data({ a: [1, 2, 3], b: [10, 20, 30] })
|
|
16
|
+
* >>> df
|
|
17
|
+
* shape: (3, 2)
|
|
18
|
+
* ┌───┬────┐
|
|
19
|
+
* │ a │ b │
|
|
20
|
+
* ├───┼────┤
|
|
21
|
+
* │ 1 │ 10 │
|
|
22
|
+
* │ 2 │ 20 │
|
|
23
|
+
* │ 3 │ 30 │
|
|
24
|
+
* └───┴────┘
|
|
25
|
+
* >>> df.withColumns($df.col("a").between(1, 2).alias("in_range"))
|
|
16
26
|
* shape: (3, 3)
|
|
17
|
-
*
|
|
18
|
-
* │ a │ b
|
|
19
|
-
*
|
|
20
|
-
* │ 1 │
|
|
21
|
-
* │ 2 │
|
|
22
|
-
* │ 3 │
|
|
23
|
-
*
|
|
27
|
+
* ┌───┬────┬──────────┐
|
|
28
|
+
* │ a │ b │ in_range │
|
|
29
|
+
* ├───┼────┼──────────┤
|
|
30
|
+
* │ 1 │ 10 │ true │
|
|
31
|
+
* │ 2 │ 20 │ true │
|
|
32
|
+
* │ 3 │ 30 │ false │
|
|
33
|
+
* └───┴────┴──────────┘
|
|
24
34
|
*/
|
|
25
|
-
between(lower: any, upper: any, closed?: "both" | "left" | "right" | "none"):
|
|
35
|
+
between(lower: any, upper: any, closed?: "both" | "left" | "right" | "none"): any;
|
|
26
36
|
/**
|
|
27
37
|
* Boolean comparison: Returns true if column values match the specified value exactly.
|
|
28
38
|
* @param val The value or column expression to compare against.
|
|
29
39
|
* @returns ColumnExpression
|
|
30
40
|
* @example
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
*
|
|
42
|
-
*
|
|
43
|
-
* >>> df.with_columns($df.col("a").eq(2).alias("is_two"))
|
|
41
|
+
* >>> const df = $df.data({ a: [1, 2, 3] })
|
|
42
|
+
* >>> df
|
|
43
|
+
* shape: (3, 1)
|
|
44
|
+
* ┌───┐
|
|
45
|
+
* │ a │
|
|
46
|
+
* ├───┤
|
|
47
|
+
* │ 1 │
|
|
48
|
+
* │ 2 │
|
|
49
|
+
* │ 3 │
|
|
50
|
+
* └───┘
|
|
51
|
+
* >>> df.withColumns($df.col("a").eq(2).alias("is_two"))
|
|
44
52
|
* shape: (3, 2)
|
|
45
53
|
* ┌───┬────────┐
|
|
46
54
|
* │ a │ is_two │
|
|
@@ -56,8 +64,17 @@ export declare class ComparisonExpr extends ExprBase {
|
|
|
56
64
|
* @param val The value or column expression to compare against.
|
|
57
65
|
* @returns ColumnExpression
|
|
58
66
|
* @example
|
|
59
|
-
|
|
60
|
-
|
|
67
|
+
* >>> const df = $df.data({ a: [1, null, 3], b: [null, 2, null] })
|
|
68
|
+
* >>> df
|
|
69
|
+
* shape: (3, 2)
|
|
70
|
+
* ┌──────┬──────┐
|
|
71
|
+
* │ a │ b │
|
|
72
|
+
* ├──────┼──────┤
|
|
73
|
+
* │ 1 │ null │
|
|
74
|
+
* │ null │ 2 │
|
|
75
|
+
* │ 3 │ null │
|
|
76
|
+
* └──────┴──────┘
|
|
77
|
+
* >>> df.withColumns($df.col("a").eqMissing(null).alias("is_missing"))
|
|
61
78
|
* shape: (3, 2)
|
|
62
79
|
* ┌──────┬────────────┐
|
|
63
80
|
* │ a │ is_missing │
|
|
@@ -67,22 +84,31 @@ export declare class ComparisonExpr extends ExprBase {
|
|
|
67
84
|
* │ 3 │ false │
|
|
68
85
|
* └──────┴────────────┘
|
|
69
86
|
*/
|
|
70
|
-
|
|
87
|
+
eqMissing(val: any): this;
|
|
71
88
|
/**
|
|
72
89
|
* Boolean comparison: Returns true if greater than or equal to argument.
|
|
73
90
|
* @param val The value or column expression to compare against.
|
|
74
91
|
* @returns ColumnExpression
|
|
75
92
|
* @example
|
|
76
|
-
|
|
77
|
-
|
|
93
|
+
* >>> const df = $df.data({ a: [1, 2, 3] })
|
|
94
|
+
* >>> df
|
|
95
|
+
* shape: (3, 1)
|
|
96
|
+
* ┌───┐
|
|
97
|
+
* │ a │
|
|
98
|
+
* ├───┤
|
|
99
|
+
* │ 1 │
|
|
100
|
+
* │ 2 │
|
|
101
|
+
* │ 3 │
|
|
102
|
+
* └───┘
|
|
103
|
+
* >>> df.withColumns($df.col("a").ge(2).alias("ge_two"))
|
|
78
104
|
* shape: (3, 2)
|
|
79
|
-
*
|
|
80
|
-
* │
|
|
81
|
-
*
|
|
82
|
-
* │
|
|
83
|
-
* │
|
|
84
|
-
* │
|
|
85
|
-
*
|
|
105
|
+
* ┌───┬────────┐
|
|
106
|
+
* │ a │ ge_two │
|
|
107
|
+
* ├───┼────────┤
|
|
108
|
+
* │ 1 │ false │
|
|
109
|
+
* │ 2 │ true │
|
|
110
|
+
* │ 3 │ true │
|
|
111
|
+
* └───┴────────┘
|
|
86
112
|
*/
|
|
87
113
|
ge(val: any): this;
|
|
88
114
|
/**
|
|
@@ -90,228 +116,362 @@ export declare class ComparisonExpr extends ExprBase {
|
|
|
90
116
|
* @param val The value or column expression to compare against.
|
|
91
117
|
* @returns ColumnExpression
|
|
92
118
|
* @example
|
|
93
|
-
|
|
94
|
-
|
|
119
|
+
* >>> const df = $df.data({ a: [1, 2, 3] })
|
|
120
|
+
* >>> df
|
|
121
|
+
* shape: (3, 1)
|
|
122
|
+
* ┌───┐
|
|
123
|
+
* │ a │
|
|
124
|
+
* ├───┤
|
|
125
|
+
* │ 1 │
|
|
126
|
+
* │ 2 │
|
|
127
|
+
* │ 3 │
|
|
128
|
+
* └───┘
|
|
129
|
+
* >>> df.withColumns($df.col("a").gt(2).alias("gt_two"))
|
|
95
130
|
* shape: (3, 2)
|
|
96
|
-
*
|
|
97
|
-
* │
|
|
98
|
-
*
|
|
99
|
-
* │
|
|
100
|
-
* │
|
|
101
|
-
* │
|
|
102
|
-
*
|
|
131
|
+
* ┌───┬────────┐
|
|
132
|
+
* │ a │ gt_two │
|
|
133
|
+
* ├───┼────────┤
|
|
134
|
+
* │ 1 │ false │
|
|
135
|
+
* │ 2 │ false │
|
|
136
|
+
* │ 3 │ true │
|
|
137
|
+
* └───┴────────┘
|
|
103
138
|
*/
|
|
104
139
|
gt(val: any): this;
|
|
105
|
-
/**
|
|
106
|
-
* Aggregation: Checks if any value in the group is null.
|
|
107
|
-
* @returns ColumnExpression
|
|
108
|
-
* @example
|
|
109
|
-
* >>> const df = $df.data({ group: ["A", "A"], val: [10, null] })
|
|
110
|
-
* >>> df.group_by("group").agg($df.col("val").has_nulls().alias("has_nulls"))
|
|
111
|
-
* shape: (1, 2)
|
|
112
|
-
* ┌───────┬───────────┐
|
|
113
|
-
* │ group │ has_nulls │
|
|
114
|
-
* ├───────┼───────────┤
|
|
115
|
-
* │ "A" │ true │
|
|
116
|
-
* └───────┴───────────┘
|
|
117
|
-
*/
|
|
118
|
-
has_nulls(): any;
|
|
119
140
|
/**
|
|
120
141
|
* Determines if floating-point values are approximately equal within tolerances.
|
|
121
142
|
* @param other The value or expression to compare against.
|
|
122
|
-
* @param options Tolerance values absolute (
|
|
143
|
+
* @param options Tolerance values absolute (absTol) and relative (relTol), and NaN options.
|
|
123
144
|
* @returns ColumnExpression
|
|
124
145
|
* @example
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
146
|
+
* >>> const df = $df.data({ a: [1, 2, 3] })
|
|
147
|
+
* >>> df
|
|
148
|
+
* shape: (3, 1)
|
|
149
|
+
* ┌───┐
|
|
150
|
+
* │ a │
|
|
151
|
+
* ├───┤
|
|
152
|
+
* │ 1 │
|
|
153
|
+
* │ 2 │
|
|
154
|
+
* │ 3 │
|
|
155
|
+
* └───┘
|
|
156
|
+
* >>> df.withColumns($df.col("a").isClose(1.0).alias("close"))
|
|
157
|
+
* shape: (3, 2)
|
|
158
|
+
* ┌───┬───────┐
|
|
159
|
+
* │ a │ close │
|
|
160
|
+
* ├───┼───────┤
|
|
161
|
+
* │ 1 │ true │
|
|
162
|
+
* │ 2 │ false │
|
|
163
|
+
* │ 3 │ false │
|
|
164
|
+
* └───┴───────┘
|
|
134
165
|
*/
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
166
|
+
isClose(other: any, { absTol, relTol, nansEqual }?: {
|
|
167
|
+
absTol?: number;
|
|
168
|
+
relTol?: number;
|
|
169
|
+
nansEqual?: boolean;
|
|
139
170
|
}): this;
|
|
140
171
|
/**
|
|
141
172
|
* Checks if values occur more than once in the column.
|
|
142
173
|
* @returns ColumnExpression
|
|
143
174
|
* @example
|
|
144
|
-
|
|
145
|
-
|
|
175
|
+
* >>> const df = $df.data({ a: [1, 2, 3] })
|
|
176
|
+
* >>> df
|
|
177
|
+
* shape: (3, 1)
|
|
178
|
+
* ┌───┐
|
|
179
|
+
* │ a │
|
|
180
|
+
* ├───┤
|
|
181
|
+
* │ 1 │
|
|
182
|
+
* │ 2 │
|
|
183
|
+
* │ 3 │
|
|
184
|
+
* └───┘
|
|
185
|
+
* >>> df.withColumns($df.col("a").isDuplicated().alias("dup"))
|
|
146
186
|
* shape: (3, 2)
|
|
147
187
|
* ┌───┬───────┐
|
|
148
188
|
* │ a │ dup │
|
|
149
189
|
* ├───┼───────┤
|
|
150
190
|
* │ 1 │ false │
|
|
151
|
-
* │ 2 │
|
|
152
|
-
* │
|
|
191
|
+
* │ 2 │ false │
|
|
192
|
+
* │ 3 │ false │
|
|
153
193
|
* └───┴───────┘
|
|
154
194
|
*/
|
|
155
|
-
|
|
195
|
+
isDuplicated(): this;
|
|
156
196
|
/**
|
|
157
197
|
* Checks if strings or nested arrays have length 0.
|
|
158
198
|
* @param options Config options including whether to ignore nulls inside arrays.
|
|
159
199
|
* @returns ColumnExpression
|
|
160
200
|
* @example
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
201
|
+
* >>> const df = $df.data({ s: ["apple", "banana", "cherry"] })
|
|
202
|
+
* >>> df
|
|
203
|
+
* shape: (3, 1)
|
|
204
|
+
* ┌──────────┐
|
|
205
|
+
* │ s │
|
|
206
|
+
* ├──────────┤
|
|
207
|
+
* │ "apple" │
|
|
208
|
+
* │ "banana" │
|
|
209
|
+
* │ "cherry" │
|
|
210
|
+
* └──────────┘
|
|
211
|
+
* >>> df.withColumns($df.col("s").isEmpty().alias("empty"))
|
|
212
|
+
* shape: (2, 2)
|
|
213
|
+
* ┌─────────────┬───────┐
|
|
214
|
+
* │ s │ empty │
|
|
215
|
+
* ├─────────────┼───────┤
|
|
216
|
+
* │ " hello " │ false │
|
|
217
|
+
* │ " world " │ false │
|
|
218
|
+
* └─────────────┴───────┘
|
|
171
219
|
*/
|
|
172
|
-
|
|
220
|
+
isEmpty({ ignoreNulls }?: {
|
|
173
221
|
ignoreNulls?: boolean;
|
|
174
222
|
}): this;
|
|
175
223
|
/**
|
|
176
224
|
* Checks if values are finite numbers (not NaN or Infinity).
|
|
177
225
|
* @returns ColumnExpression
|
|
178
226
|
* @example
|
|
179
|
-
|
|
180
|
-
|
|
227
|
+
* >>> const df = $df.data({ a: [1, 2, 3] })
|
|
228
|
+
* >>> df
|
|
229
|
+
* shape: (3, 1)
|
|
230
|
+
* ┌───┐
|
|
231
|
+
* │ a │
|
|
232
|
+
* ├───┤
|
|
233
|
+
* │ 1 │
|
|
234
|
+
* │ 2 │
|
|
235
|
+
* │ 3 │
|
|
236
|
+
* └───┘
|
|
237
|
+
* >>> df.withColumns($df.col("a").isFinite().alias("finite"))
|
|
181
238
|
* shape: (3, 2)
|
|
182
|
-
*
|
|
183
|
-
* │ a
|
|
184
|
-
*
|
|
185
|
-
* │ 1
|
|
186
|
-
* │
|
|
187
|
-
* │
|
|
188
|
-
*
|
|
239
|
+
* ┌───┬────────┐
|
|
240
|
+
* │ a │ finite │
|
|
241
|
+
* ├───┼────────┤
|
|
242
|
+
* │ 1 │ true │
|
|
243
|
+
* │ 2 │ true │
|
|
244
|
+
* │ 3 │ true │
|
|
245
|
+
* └───┴────────┘
|
|
189
246
|
*/
|
|
190
|
-
|
|
247
|
+
isFinite(): this;
|
|
191
248
|
/**
|
|
192
249
|
* Checks if column values are members of a specified array or list.
|
|
193
250
|
* @param values An array of candidate values or a single value to match against.
|
|
194
251
|
* @returns ColumnExpression
|
|
195
252
|
* @example
|
|
196
|
-
|
|
197
|
-
|
|
253
|
+
* >>> const df = $df.data({ s: ["apple", "banana", "cherry"] })
|
|
254
|
+
* >>> df
|
|
255
|
+
* shape: (3, 1)
|
|
256
|
+
* ┌──────────┐
|
|
257
|
+
* │ s │
|
|
258
|
+
* ├──────────┤
|
|
259
|
+
* │ "apple" │
|
|
260
|
+
* │ "banana" │
|
|
261
|
+
* │ "cherry" │
|
|
262
|
+
* └──────────┘
|
|
263
|
+
* >>> df.withColumns($df.col("s").isIn(["apple", "banana"]).alias("in_list"))
|
|
198
264
|
* shape: (3, 2)
|
|
199
265
|
* ┌──────────┬─────────┐
|
|
200
|
-
* │
|
|
266
|
+
* │ s │ in_list │
|
|
201
267
|
* ├──────────┼─────────┤
|
|
202
|
-
* │ "
|
|
203
|
-
* │ "
|
|
204
|
-
* │ "
|
|
268
|
+
* │ "apple" │ true │
|
|
269
|
+
* │ "banana" │ true │
|
|
270
|
+
* │ "cherry" │ false │
|
|
205
271
|
* └──────────┴─────────┘
|
|
206
272
|
*/
|
|
207
|
-
|
|
273
|
+
isIn(values: any[] | any): this;
|
|
208
274
|
/**
|
|
209
275
|
* Checks if values are positive or negative Infinity.
|
|
210
276
|
* @returns ColumnExpression
|
|
211
277
|
* @example
|
|
212
|
-
|
|
213
|
-
|
|
278
|
+
* >>> const df = $df.data({ a: [1, 2, 3] })
|
|
279
|
+
* >>> df
|
|
280
|
+
* shape: (3, 1)
|
|
281
|
+
* ┌───┐
|
|
282
|
+
* │ a │
|
|
283
|
+
* ├───┤
|
|
284
|
+
* │ 1 │
|
|
285
|
+
* │ 2 │
|
|
286
|
+
* │ 3 │
|
|
287
|
+
* └───┘
|
|
288
|
+
* >>> df.withColumns($df.col("a").isInfinite().alias("inf"))
|
|
214
289
|
* shape: (3, 2)
|
|
215
|
-
*
|
|
216
|
-
* │ a
|
|
217
|
-
*
|
|
218
|
-
* │ 1
|
|
219
|
-
* │
|
|
220
|
-
* │
|
|
221
|
-
*
|
|
290
|
+
* ┌───┬───────┐
|
|
291
|
+
* │ a │ inf │
|
|
292
|
+
* ├───┼───────┤
|
|
293
|
+
* │ 1 │ false │
|
|
294
|
+
* │ 2 │ false │
|
|
295
|
+
* │ 3 │ false │
|
|
296
|
+
* └───┴───────┘
|
|
222
297
|
*/
|
|
223
|
-
|
|
298
|
+
isInfinite(): this;
|
|
224
299
|
/**
|
|
225
300
|
* Checks if values are NaN.
|
|
226
301
|
* @returns ColumnExpression
|
|
227
302
|
* @example
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
303
|
+
* >>> const df = $df.data({ a: [1, 2, 3] })
|
|
304
|
+
* >>> df
|
|
305
|
+
* shape: (3, 1)
|
|
306
|
+
* ┌───┐
|
|
307
|
+
* │ a │
|
|
308
|
+
* ├───┤
|
|
309
|
+
* │ 1 │
|
|
310
|
+
* │ 2 │
|
|
311
|
+
* │ 3 │
|
|
312
|
+
* └───┘
|
|
313
|
+
* >>> df.withColumns($df.col("a").isNan().alias("nan"))
|
|
314
|
+
* shape: (3, 2)
|
|
315
|
+
* ┌───┬───────┐
|
|
316
|
+
* │ a │ nan │
|
|
317
|
+
* ├───┼───────┤
|
|
318
|
+
* │ 1 │ false │
|
|
319
|
+
* │ 2 │ false │
|
|
320
|
+
* │ 3 │ false │
|
|
321
|
+
* └───┴───────┘
|
|
237
322
|
*/
|
|
238
|
-
|
|
323
|
+
isNan(): this;
|
|
239
324
|
/**
|
|
240
325
|
* Checks if values are not NaN.
|
|
241
326
|
* @returns ColumnExpression
|
|
242
327
|
* @example
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
328
|
+
* >>> const df = $df.data({ a: [1, 2, 3] })
|
|
329
|
+
* >>> df
|
|
330
|
+
* shape: (3, 1)
|
|
331
|
+
* ┌───┐
|
|
332
|
+
* │ a │
|
|
333
|
+
* ├───┤
|
|
334
|
+
* │ 1 │
|
|
335
|
+
* │ 2 │
|
|
336
|
+
* │ 3 │
|
|
337
|
+
* └───┘
|
|
338
|
+
* >>> df.withColumns($df.col("a").isNotNan().alias("not_nan"))
|
|
339
|
+
* shape: (3, 2)
|
|
340
|
+
* ┌───┬─────────┐
|
|
341
|
+
* │ a │ not_nan │
|
|
342
|
+
* ├───┼─────────┤
|
|
343
|
+
* │ 1 │ true │
|
|
344
|
+
* │ 2 │ true │
|
|
345
|
+
* │ 3 │ true │
|
|
346
|
+
* └───┴─────────┘
|
|
252
347
|
*/
|
|
253
|
-
|
|
348
|
+
isNotNan(): any;
|
|
349
|
+
/**
|
|
350
|
+
* Checks if column values match the N-th distinct value by positive or negative index position.
|
|
351
|
+
* @param index The 0-based or negative index position into the ordered distinct values (e.g. 0 for first distinct, -1 for last distinct).
|
|
352
|
+
* @param nullOnOob If true, returns null if index is out of bounds (default: true).
|
|
353
|
+
* @returns ColumnExpression
|
|
354
|
+
* @example
|
|
355
|
+
* >>> const df = $df.data({ a: [1, 2, 3], b: [10, 20, 30] })
|
|
356
|
+
* >>> df
|
|
357
|
+
* shape: (3, 2)
|
|
358
|
+
* ┌───┬────┐
|
|
359
|
+
* │ a │ b │
|
|
360
|
+
* ├───┼────┤
|
|
361
|
+
* │ 1 │ 10 │
|
|
362
|
+
* │ 2 │ 20 │
|
|
363
|
+
* │ 3 │ 30 │
|
|
364
|
+
* └───┴────┘
|
|
365
|
+
* >>> df.withColumns($df.col("a").isNDistinct(0).alias("is_first"))
|
|
366
|
+
* shape: (3, 3)
|
|
367
|
+
* ┌───┬────┬──────────┐
|
|
368
|
+
* │ a │ b │ is_first │
|
|
369
|
+
* ├───┼────┼──────────┤
|
|
370
|
+
* │ 1 │ 10 │ true │
|
|
371
|
+
* │ 2 │ 20 │ false │
|
|
372
|
+
* │ 3 │ 30 │ false │
|
|
373
|
+
* └───┴────┴──────────┘
|
|
374
|
+
*/
|
|
375
|
+
isNDistinct(index: number, nullOnOob?: boolean): this;
|
|
254
376
|
/**
|
|
255
377
|
* Checks if column values are non-null and valid (not null, undefined, or missing).
|
|
256
378
|
* @returns ColumnExpression
|
|
257
379
|
* @example
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
380
|
+
* >>> const df = $df.data({ a: [1, null, 3], b: [null, 2, null] })
|
|
381
|
+
* >>> df
|
|
382
|
+
* shape: (3, 2)
|
|
383
|
+
* ┌──────┬──────┐
|
|
384
|
+
* │ a │ b │
|
|
385
|
+
* ├──────┼──────┤
|
|
386
|
+
* │ 1 │ null │
|
|
387
|
+
* │ null │ 2 │
|
|
388
|
+
* │ 3 │ null │
|
|
389
|
+
* └──────┴──────┘
|
|
390
|
+
* >>> df.withColumns($df.col("a").isNotNull().alias("valid"))
|
|
391
|
+
* shape: (3, 2)
|
|
392
|
+
* ┌──────┬───────┐
|
|
393
|
+
* │ a │ valid │
|
|
394
|
+
* ├──────┼───────┤
|
|
395
|
+
* │ 1 │ true │
|
|
396
|
+
* │ null │ false │
|
|
397
|
+
* │ 3 │ true │
|
|
398
|
+
* └──────┴───────┘
|
|
267
399
|
*/
|
|
268
|
-
|
|
400
|
+
isNotNull(): any;
|
|
269
401
|
/**
|
|
270
402
|
* Checks if column values are null, undefined, or missing.
|
|
271
403
|
* @returns ColumnExpression
|
|
272
404
|
* @example
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
405
|
+
* >>> const df = $df.data({ a: [1, null, 3], b: [null, 2, null] })
|
|
406
|
+
* >>> df
|
|
407
|
+
* shape: (3, 2)
|
|
408
|
+
* ┌──────┬──────┐
|
|
409
|
+
* │ a │ b │
|
|
410
|
+
* ├──────┼──────┤
|
|
411
|
+
* │ 1 │ null │
|
|
412
|
+
* │ null │ 2 │
|
|
413
|
+
* │ 3 │ null │
|
|
414
|
+
* └──────┴──────┘
|
|
415
|
+
* >>> df.withColumns($df.col("a").isNull().alias("missing"))
|
|
416
|
+
* shape: (3, 2)
|
|
417
|
+
* ┌──────┬─────────┐
|
|
418
|
+
* │ a │ missing │
|
|
419
|
+
* ├──────┼─────────┤
|
|
420
|
+
* │ 1 │ false │
|
|
421
|
+
* │ null │ true │
|
|
422
|
+
* │ 3 │ false │
|
|
423
|
+
* └──────┴─────────┘
|
|
282
424
|
*/
|
|
283
|
-
|
|
425
|
+
isNull(): this;
|
|
284
426
|
/**
|
|
285
427
|
* Checks if values occur exactly once in the column.
|
|
286
428
|
* @returns ColumnExpression
|
|
287
429
|
* @example
|
|
288
|
-
|
|
289
|
-
|
|
430
|
+
* >>> const df = $df.data({ a: [1, 2, 3] })
|
|
431
|
+
* >>> df
|
|
432
|
+
* shape: (3, 1)
|
|
433
|
+
* ┌───┐
|
|
434
|
+
* │ a │
|
|
435
|
+
* ├───┤
|
|
436
|
+
* │ 1 │
|
|
437
|
+
* │ 2 │
|
|
438
|
+
* │ 3 │
|
|
439
|
+
* └───┘
|
|
440
|
+
* >>> df.withColumns($df.col("a").isUnique().alias("uniq"))
|
|
290
441
|
* shape: (3, 2)
|
|
291
|
-
*
|
|
292
|
-
* │ a │ uniq
|
|
293
|
-
*
|
|
294
|
-
* │ 1 │ true
|
|
295
|
-
* │ 2 │
|
|
296
|
-
* │
|
|
297
|
-
*
|
|
442
|
+
* ┌───┬──────┐
|
|
443
|
+
* │ a │ uniq │
|
|
444
|
+
* ├───┼──────┤
|
|
445
|
+
* │ 1 │ true │
|
|
446
|
+
* │ 2 │ true │
|
|
447
|
+
* │ 3 │ true │
|
|
448
|
+
* └───┴──────┘
|
|
298
449
|
*/
|
|
299
|
-
|
|
450
|
+
isUnique(): any;
|
|
300
451
|
/**
|
|
301
452
|
* Boolean comparison: Returns true if less than or equal to argument.
|
|
302
453
|
* @param val The value or column expression to compare against.
|
|
303
454
|
* @returns ColumnExpression
|
|
304
455
|
* @example
|
|
305
|
-
|
|
306
|
-
|
|
456
|
+
* >>> const df = $df.data({ a: [1, 2, 3] })
|
|
457
|
+
* >>> df
|
|
458
|
+
* shape: (3, 1)
|
|
459
|
+
* ┌───┐
|
|
460
|
+
* │ a │
|
|
461
|
+
* ├───┤
|
|
462
|
+
* │ 1 │
|
|
463
|
+
* │ 2 │
|
|
464
|
+
* │ 3 │
|
|
465
|
+
* └───┘
|
|
466
|
+
* >>> df.withColumns($df.col("a").le(2).alias("le_two"))
|
|
307
467
|
* shape: (3, 2)
|
|
308
|
-
*
|
|
309
|
-
* │
|
|
310
|
-
*
|
|
311
|
-
* │
|
|
312
|
-
* │
|
|
313
|
-
* │
|
|
314
|
-
*
|
|
468
|
+
* ┌───┬────────┐
|
|
469
|
+
* │ a │ le_two │
|
|
470
|
+
* ├───┼────────┤
|
|
471
|
+
* │ 1 │ true │
|
|
472
|
+
* │ 2 │ true │
|
|
473
|
+
* │ 3 │ false │
|
|
474
|
+
* └───┴────────┘
|
|
315
475
|
*/
|
|
316
476
|
le(val: any): this;
|
|
317
477
|
/**
|
|
@@ -319,16 +479,25 @@ export declare class ComparisonExpr extends ExprBase {
|
|
|
319
479
|
* @param val The value or column expression to compare against.
|
|
320
480
|
* @returns ColumnExpression
|
|
321
481
|
* @example
|
|
322
|
-
|
|
323
|
-
|
|
482
|
+
* >>> const df = $df.data({ a: [1, 2, 3] })
|
|
483
|
+
* >>> df
|
|
484
|
+
* shape: (3, 1)
|
|
485
|
+
* ┌───┐
|
|
486
|
+
* │ a │
|
|
487
|
+
* ├───┤
|
|
488
|
+
* │ 1 │
|
|
489
|
+
* │ 2 │
|
|
490
|
+
* │ 3 │
|
|
491
|
+
* └───┘
|
|
492
|
+
* >>> df.withColumns($df.col("a").lt(2).alias("lt_two"))
|
|
324
493
|
* shape: (3, 2)
|
|
325
|
-
*
|
|
326
|
-
* │
|
|
327
|
-
*
|
|
328
|
-
* │
|
|
329
|
-
* │
|
|
330
|
-
* │
|
|
331
|
-
*
|
|
494
|
+
* ┌───┬────────┐
|
|
495
|
+
* │ a │ lt_two │
|
|
496
|
+
* ├───┼────────┤
|
|
497
|
+
* │ 1 │ true │
|
|
498
|
+
* │ 2 │ false │
|
|
499
|
+
* │ 3 │ false │
|
|
500
|
+
* └───┴────────┘
|
|
332
501
|
*/
|
|
333
502
|
lt(val: any): this;
|
|
334
503
|
/**
|
|
@@ -336,15 +505,25 @@ export declare class ComparisonExpr extends ExprBase {
|
|
|
336
505
|
* @param val The value or column expression to compare against.
|
|
337
506
|
* @returns ColumnExpression
|
|
338
507
|
* @example
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
508
|
+
* >>> const df = $df.data({ a: [1, 2, 3] })
|
|
509
|
+
* >>> df
|
|
510
|
+
* shape: (3, 1)
|
|
511
|
+
* ┌───┐
|
|
512
|
+
* │ a │
|
|
513
|
+
* ├───┤
|
|
514
|
+
* │ 1 │
|
|
515
|
+
* │ 2 │
|
|
516
|
+
* │ 3 │
|
|
517
|
+
* └───┘
|
|
518
|
+
* >>> df.withColumns($df.col("a").ne(2).alias("not_two"))
|
|
519
|
+
* shape: (3, 2)
|
|
520
|
+
* ┌───┬─────────┐
|
|
521
|
+
* │ a │ not_two │
|
|
522
|
+
* ├───┼─────────┤
|
|
523
|
+
* │ 1 │ true │
|
|
524
|
+
* │ 2 │ false │
|
|
525
|
+
* │ 3 │ true │
|
|
526
|
+
* └───┴─────────┘
|
|
348
527
|
*/
|
|
349
528
|
ne(val: any): this;
|
|
350
529
|
/**
|
|
@@ -352,8 +531,17 @@ export declare class ComparisonExpr extends ExprBase {
|
|
|
352
531
|
* @param val The value or column expression to compare against.
|
|
353
532
|
* @returns ColumnExpression
|
|
354
533
|
* @example
|
|
355
|
-
|
|
356
|
-
|
|
534
|
+
* >>> const df = $df.data({ a: [1, null, 3], b: [null, 2, null] })
|
|
535
|
+
* >>> df
|
|
536
|
+
* shape: (3, 2)
|
|
537
|
+
* ┌──────┬──────┐
|
|
538
|
+
* │ a │ b │
|
|
539
|
+
* ├──────┼──────┤
|
|
540
|
+
* │ 1 │ null │
|
|
541
|
+
* │ null │ 2 │
|
|
542
|
+
* │ 3 │ null │
|
|
543
|
+
* └──────┴──────┘
|
|
544
|
+
* >>> df.withColumns($df.col("a").neMissing(null).alias("not_missing"))
|
|
357
545
|
* shape: (3, 2)
|
|
358
546
|
* ┌──────┬─────────────┐
|
|
359
547
|
* │ a │ not_missing │
|
|
@@ -363,22 +551,31 @@ export declare class ComparisonExpr extends ExprBase {
|
|
|
363
551
|
* │ 3 │ true │
|
|
364
552
|
* └──────┴─────────────┘
|
|
365
553
|
*/
|
|
366
|
-
|
|
554
|
+
neMissing(val: any): any;
|
|
367
555
|
/**
|
|
368
556
|
* Checks if values are not elements of a specific array or set list.
|
|
369
557
|
* @param values An array of candidate values or a single value to match against.
|
|
370
558
|
* @returns ColumnExpression
|
|
371
559
|
* @example
|
|
372
|
-
|
|
373
|
-
|
|
560
|
+
* >>> const df = $df.data({ s: ["apple", "banana", "cherry"] })
|
|
561
|
+
* >>> df
|
|
562
|
+
* shape: (3, 1)
|
|
563
|
+
* ┌──────────┐
|
|
564
|
+
* │ s │
|
|
565
|
+
* ├──────────┤
|
|
566
|
+
* │ "apple" │
|
|
567
|
+
* │ "banana" │
|
|
568
|
+
* │ "cherry" │
|
|
569
|
+
* └──────────┘
|
|
570
|
+
* >>> df.withColumns($df.col("s").notIn(["apple", "banana"]).alias("not_in"))
|
|
374
571
|
* shape: (3, 2)
|
|
375
572
|
* ┌──────────┬────────┐
|
|
376
|
-
* │
|
|
573
|
+
* │ s │ not_in │
|
|
377
574
|
* ├──────────┼────────┤
|
|
378
|
-
* │
|
|
379
|
-
* │
|
|
380
|
-
* │
|
|
575
|
+
* │ "apple" │ false │
|
|
576
|
+
* │ "banana" │ false │
|
|
577
|
+
* │ "cherry" │ true │
|
|
381
578
|
* └──────────┴────────┘
|
|
382
579
|
*/
|
|
383
|
-
|
|
580
|
+
notIn(values: any[] | any): any;
|
|
384
581
|
}
|