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.
Files changed (59) hide show
  1. package/README.md +148 -235
  2. package/dist/api.d.ts +41 -36
  3. package/dist/columnExpressions/ColumnExpr.d.ts +5 -8
  4. package/dist/columnExpressions/functions/all.d.ts +13 -13
  5. package/dist/columnExpressions/functions/coalesce.d.ts +2 -2
  6. package/dist/columnExpressions/functions/duration.d.ts +16 -21
  7. package/dist/columnExpressions/functions/element.d.ts +10 -10
  8. package/dist/columnExpressions/functions/exclude.d.ts +14 -14
  9. package/dist/columnExpressions/functions/implode.d.ts +7 -7
  10. package/dist/columnExpressions/functions/lit.d.ts +9 -9
  11. package/dist/columnExpressions/functions/seqRange.d.ts +69 -0
  12. package/dist/columnExpressions/functions/struct.d.ts +6 -6
  13. package/dist/columnExpressions/functions/when.d.ts +25 -28
  14. package/dist/columnExpressions/index.d.ts +3 -7
  15. package/dist/columnExpressions/mixins/AggregationExpr.d.ts +550 -221
  16. package/dist/columnExpressions/mixins/ArithmeticExpr.d.ts +701 -327
  17. package/dist/columnExpressions/mixins/ArrayExpr.d.ts +508 -212
  18. package/dist/columnExpressions/mixins/ComparisonExpr.d.ts +398 -201
  19. package/dist/columnExpressions/mixins/LogicalExpr.d.ts +59 -29
  20. package/dist/columnExpressions/mixins/ManipulationExpr.d.ts +23 -9
  21. package/dist/columnExpressions/mixins/StandardExpr.d.ts +3234 -0
  22. package/dist/columnExpressions/mixins/StringExpr.d.ts +1163 -524
  23. package/dist/columnExpressions/mixins/StructExpr.d.ts +67 -25
  24. package/dist/columnExpressions/mixins/TemporalExpr.d.ts +518 -212
  25. package/dist/columnExpressions/mixins/WindowExpr.d.ts +270 -102
  26. package/dist/columnExpressions/typeInference.d.ts +3 -3
  27. package/dist/columnExpressions/types.d.ts +5 -0
  28. package/dist/columnExpressions/utils.d.ts +7 -0
  29. package/dist/constants.d.ts +11 -2
  30. package/dist/dataframe/dataframe.d.ts +755 -592
  31. package/dist/dataframe/grouped/grouped.d.ts +24 -6
  32. package/dist/dataframe/grouped.d.ts +70 -0
  33. package/dist/dataframe/index.d.ts +1 -1
  34. package/dist/dataframe/lazy.d.ts +37 -0
  35. package/dist/dataframe/types.d.ts +46 -22
  36. package/dist/dataframe/utils.d.ts +10 -4
  37. package/dist/datatypes/index.d.ts +11 -4
  38. package/dist/expressions.js +1 -0
  39. package/dist/expressions.mjs +1 -0
  40. package/dist/functions/concat.d.ts +68 -16
  41. package/dist/functions/index.d.ts +2 -2
  42. package/dist/functions/readCsv.d.ts +35 -0
  43. package/dist/functions/readJson.d.ts +33 -0
  44. package/dist/index.js +5 -6
  45. package/dist/index.mjs +5 -6
  46. package/dist/types.d.ts +42 -9
  47. package/dist/utils/array.d.ts +17 -14
  48. package/dist/utils/csv.d.ts +4 -1
  49. package/dist/utils/date.d.ts +3 -19
  50. package/dist/utils/duration.d.ts +7 -5
  51. package/dist/utils/json.d.ts +5 -3
  52. package/dist/utils/object.d.ts +0 -18
  53. package/dist/utils/string.d.ts +5 -0
  54. package/dist/utils.js +4 -0
  55. package/dist/utils.mjs +4 -0
  56. package/package.json +29 -8
  57. package/dist/assets/index-DBhGK6Tp.css +0 -1
  58. package/dist/assets/index-DEJEV_tU.js +0 -195
  59. 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
- * >>> df.with_columns($df.col("a").between(1, 2).alias("in_range"))
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 │ in_range │
19
- * ├───┼───┼──────────┤
20
- * │ 1 │ x │ true │
21
- * │ 2 │ y │ true │
22
- * │ 3 │ z │ false │
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"): this;
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
- * >>> const df = $df.data({
32
- * ... a: [1, 2, 3]
33
- * ... })
34
- * shape: (3, 1)
35
- * ┌───┐
36
- * │ a │
37
- * ├───┤
38
- * │ 1
39
- * │ 2
40
- * │ 3 │
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
- * >>> const df = $df.data({ a: [1, null, 3] })
60
- * >>> df.with_columns($df.col("a").eq_missing(null).alias("is_missing"))
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
- eq_missing(val: any): this;
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
- * >>> const df = $df.data({ price: [90, 100, 110] })
77
- * >>> df.with_columns($df.col("price").ge(100).alias("ge_100"))
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
- * │ pricege_100
81
- * ├───────┼────────┤
82
- * │ 90 │ false │
83
- * │ 100 │ true │
84
- * │ 110 │ true │
85
- * └───────┴────────┘
105
+ * ┌───┬────────┐
106
+ * │ age_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
- * >>> const df = $df.data({ price: [90, 100, 110] })
94
- * >>> df.with_columns($df.col("price").gt(100).alias("gt_100"))
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
- * │ pricegt_100
98
- * ├───────┼────────┤
99
- * │ 90 │ false │
100
- * │ 100 │ false │
101
- * │ 110 │ true │
102
- * └───────┴────────┘
131
+ * ┌───┬────────┐
132
+ * │ agt_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 (abs_tol) and relative (rel_tol), and NaN options.
143
+ * @param options Tolerance values absolute (absTol) and relative (relTol), and NaN options.
123
144
  * @returns ColumnExpression
124
145
  * @example
125
- * >>> const df = $df.data({ a: [1.000000001, 2.0] })
126
- * >>> df.with_columns($df.col("a").is_close(1.0).alias("close"))
127
- * shape: (2, 2)
128
- * ┌─────────────┬───────┐
129
- * │ a close
130
- * ├─────────────┼───────┤
131
- * │ 1.000000001 true │
132
- * │ 2.0 │ false
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
- is_close(other: any, { abs_tol, rel_tol, nans_equal }?: {
136
- abs_tol?: number;
137
- rel_tol?: number;
138
- nans_equal?: boolean;
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
- * >>> const df = $df.data({ a: [1, 2, 2] })
145
- * >>> df.with_columns($df.col("a").is_duplicated().alias("dup"))
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 │ true
152
- * │ 2true
191
+ * │ 2 │ false
192
+ * │ 3false
153
193
  * └───┴───────┘
154
194
  */
155
- is_duplicated(): this;
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
- * >>> const df = $df.data({ a: ["", "hello", []] })
162
- * >>> df.with_columns($df.col("a").is_empty().alias("empty"))
163
- * shape: (3, 2)
164
- * ┌─────────┬───────┐
165
- * │ a empty │
166
- * ├─────────┼───────┤
167
- * │ "" │ true
168
- * │ "hello" │ false │
169
- * │ [] │ true
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
- is_empty({ ignoreNulls }?: {
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
- * >>> const df = $df.data({ a: [1.5, Infinity, NaN] })
180
- * >>> df.with_columns($df.col("a").is_finite().alias("finite"))
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 │ finite │
184
- * ├──────────┼────────┤
185
- * │ 1.5 │ true │
186
- * │ Infinityfalse
187
- * │ NaN false
188
- * └──────────┴────────┘
239
+ * ┌───┬────────┐
240
+ * │ a │ finite │
241
+ * ├───┼────────┤
242
+ * │ 1 │ true │
243
+ * │ 2true
244
+ * │ 3 true
245
+ * └───┴────────┘
189
246
  */
190
- is_finite(): this;
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
- * >>> const df = $df.data({ category: ["toys", "books", "food"] })
197
- * >>> df.with_columns($df.col("category").is_in(["toys", "books"]).alias("in_list"))
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
- * │ category │ in_list │
266
+ * │ s │ in_list │
201
267
  * ├──────────┼─────────┤
202
- * │ "toys" │ true │
203
- * │ "books" │ true │
204
- * │ "food" │ false │
268
+ * │ "apple" │ true │
269
+ * │ "banana" │ true │
270
+ * │ "cherry" │ false │
205
271
  * └──────────┴─────────┘
206
272
  */
207
- is_in(values: any[] | any): this;
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
- * >>> const df = $df.data({ a: [1.5, Infinity, -Infinity] })
213
- * >>> df.with_columns($df.col("a").is_infinite().alias("inf"))
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 │ inf │
217
- * ├───────────┼───────┤
218
- * │ 1.5 │ false │
219
- * │ Infinity true
220
- * │ -Infinitytrue
221
- * └───────────┴───────┘
290
+ * ┌───┬───────┐
291
+ * │ a │ inf │
292
+ * ├───┼───────┤
293
+ * │ 1 │ false │
294
+ * │ 2 false
295
+ * │ 3false
296
+ * └───┴───────┘
222
297
  */
223
- is_infinite(): this;
298
+ isInfinite(): this;
224
299
  /**
225
300
  * Checks if values are NaN.
226
301
  * @returns ColumnExpression
227
302
  * @example
228
- * >>> const df = $df.data({ a: [1.5, NaN] })
229
- * >>> df.with_columns($df.col("a").is_nan().alias("nan"))
230
- * shape: (2, 2)
231
- * ┌─────┬───────┐
232
- * │ a nan
233
- * ├─────┼───────┤
234
- * │ 1.5 false │
235
- * │ NaN true │
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
- is_nan(): this;
323
+ isNan(): this;
239
324
  /**
240
325
  * Checks if values are not NaN.
241
326
  * @returns ColumnExpression
242
327
  * @example
243
- * >>> const df = $df.data({ a: [1.5, NaN] })
244
- * >>> df.with_columns($df.col("a").is_not_nan().alias("not_nan"))
245
- * shape: (2, 2)
246
- * ┌─────┬─────────┐
247
- * │ a not_nan
248
- * ├─────┼─────────┤
249
- * │ 1.5 true │
250
- * │ NaN false │
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
- is_not_nan(): this;
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
- * >>> const df = $df.data({ email: ["alice@example.com", null] })
259
- * >>> df.with_columns($df.col("email").is_not_null().alias("valid"))
260
- * shape: (2, 2)
261
- * ┌───────────────────┬───────┐
262
- * │ email valid
263
- * ├───────────────────┼───────┤
264
- * │ alice@example.com true
265
- * │ null false
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
- is_not_null(): this;
400
+ isNotNull(): any;
269
401
  /**
270
402
  * Checks if column values are null, undefined, or missing.
271
403
  * @returns ColumnExpression
272
404
  * @example
273
- * >>> const df = $df.data({ email: ["alice@example.com", null] })
274
- * >>> df.with_columns($df.col("email").is_null().alias("missing"))
275
- * shape: (2, 2)
276
- * ┌───────────────────┬─────────┐
277
- * │ email missing
278
- * ├───────────────────┼─────────┤
279
- * │ alice@example.com false
280
- * │ null true
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
- is_null(): this;
425
+ isNull(): this;
284
426
  /**
285
427
  * Checks if values occur exactly once in the column.
286
428
  * @returns ColumnExpression
287
429
  * @example
288
- * >>> const df = $df.data({ a: [1, 2, 2] })
289
- * >>> df.with_columns($df.col("a").is_unique().alias("uniq"))
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 │ false
296
- * │ 2false
297
- * └───┴───────┘
442
+ * ┌───┬──────┐
443
+ * │ a │ uniq
444
+ * ├───┼──────┤
445
+ * │ 1 │ true
446
+ * │ 2 │ true
447
+ * │ 3true
448
+ * └───┴──────┘
298
449
  */
299
- is_unique(): this;
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
- * >>> const df = $df.data({ price: [40, 50, 60] })
306
- * >>> df.with_columns($df.col("price").le(50).alias("le_50"))
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
- * │ pricele_50
310
- * ├───────┼───────┤
311
- * │ 40 │ true
312
- * │ 50 │ true
313
- * │ 60 │ false
314
- * └───────┴───────┘
468
+ * ┌───┬────────┐
469
+ * │ ale_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
- * >>> const df = $df.data({ price: [40, 50, 60] })
323
- * >>> df.with_columns($df.col("price").lt(50).alias("lt_50"))
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
- * │ pricelt_50
327
- * ├───────┼───────┤
328
- * │ 40 │ true
329
- * │ 50 │ false
330
- * │ 60 │ false
331
- * └───────┴───────┘
494
+ * ┌───┬────────┐
495
+ * │ alt_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
- * >>> const df = $df.data({ category: ["electronics", "toys"] })
340
- * >>> df.with_columns($df.col("category").ne("electronics").alias("not_elec"))
341
- * shape: (2, 2)
342
- * ┌─────────────┬──────────┐
343
- * │ category │ not_elec
344
- * ├─────────────┼──────────┤
345
- * │ electronics false │
346
- * │ toys │ true
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
- * >>> const df = $df.data({ a: [1, null, 3] })
356
- * >>> df.with_columns($df.col("a").ne_missing(null).alias("not_missing"))
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
- ne_missing(val: any): this;
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
- * >>> const df = $df.data({ category: ["toys", "books", "food"] })
373
- * >>> df.with_columns($df.col("category").not_in(["toys", "books"]).alias("not_in"))
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
- * │ category │ not_in │
573
+ * │ s │ not_in │
377
574
  * ├──────────┼────────┤
378
- * │ toys │ false │
379
- * │ books │ false │
380
- * │ food │ true │
575
+ * │ "apple" │ false │
576
+ * │ "banana" │ false │
577
+ * │ "cherry" │ true │
381
578
  * └──────────┴────────┘
382
579
  */
383
- not_in(values: any[] | any): this;
580
+ notIn(values: any[] | any): any;
384
581
  }