df-script 1.6.0 → 1.7.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -1
- package/dist/api.d.ts +2 -1
- package/dist/assets/index-DBhGK6Tp.css +1 -0
- package/dist/assets/index-DEJEV_tU.js +195 -0
- package/dist/columnExpressions/ColumnExpr.d.ts +12 -5
- package/dist/columnExpressions/ExprBase.d.ts +26 -12
- package/dist/columnExpressions/constants.d.ts +1 -0
- package/dist/columnExpressions/functions/all.d.ts +23 -0
- package/dist/columnExpressions/functions/coalesce.d.ts +29 -0
- package/dist/columnExpressions/functions/element.d.ts +25 -0
- package/dist/columnExpressions/functions/exclude.d.ts +24 -0
- package/dist/columnExpressions/functions/implode.d.ts +28 -0
- package/dist/columnExpressions/functions/lit.d.ts +27 -0
- package/dist/columnExpressions/functions/seq_range.d.ts +36 -0
- package/dist/columnExpressions/functions/struct.d.ts +31 -0
- package/dist/columnExpressions/functions/when.d.ts +36 -6
- package/dist/columnExpressions/index.d.ts +1 -0
- package/dist/columnExpressions/mixins/AggregationExpr.d.ts +334 -0
- package/dist/columnExpressions/mixins/ArithmeticExpr.d.ts +609 -0
- package/dist/columnExpressions/mixins/ArrayExpr.d.ts +533 -5
- package/dist/columnExpressions/mixins/ComparisonExpr.d.ts +353 -0
- package/dist/columnExpressions/mixins/LogicalExpr.d.ts +82 -0
- package/dist/columnExpressions/mixins/ManipulationExpr.d.ts +40 -0
- package/dist/columnExpressions/mixins/StringExpr.d.ts +656 -3
- package/dist/columnExpressions/mixins/StructExpr.d.ts +70 -0
- package/dist/columnExpressions/mixins/TemporalExpr.d.ts +530 -4
- package/dist/columnExpressions/mixins/WindowExpr.d.ts +313 -2
- package/dist/columnExpressions/types.d.ts +1 -0
- package/dist/dataframe/dataframe.d.ts +932 -2
- package/dist/dataframe/grouped/grouped.d.ts +41 -6
- package/dist/dataframe/types.d.ts +1 -0
- package/dist/dataframe/utils.d.ts +1 -0
- package/dist/datatypes/types.d.ts +45 -0
- package/dist/exceptions/index.d.ts +23 -0
- package/dist/functions/concat.d.ts +50 -0
- package/dist/functions/read_csv.d.ts +9 -0
- package/dist/functions/read_json.d.ts +7 -2
- package/dist/index.html +17 -0
- package/dist/index.js +5 -5
- package/dist/index.mjs +6 -0
- package/dist/types.d.ts +47 -14
- package/dist/utils/array.d.ts +32 -1
- package/dist/utils/csv.d.ts +1 -0
- package/dist/utils/date.d.ts +10 -27
- package/dist/utils/json.d.ts +1 -0
- package/dist/utils/number.d.ts +1 -0
- package/dist/utils/object.d.ts +1 -0
- package/dist/utils/string.d.ts +12 -0
- package/package.json +18 -4
- package/dist/columnExpressions/mixins/ListExpr.d.ts +0 -39
- package/dist/utils/guards.d.ts +0 -13
- package/dist/utils/list.d.ts +0 -217
|
@@ -1,31 +1,384 @@
|
|
|
1
1
|
import { ExprBase } from "../ExprBase";
|
|
2
|
+
/**
|
|
3
|
+
* @namespace $df.col
|
|
4
|
+
* @category ColumnExpression
|
|
5
|
+
* @syntax $df.col(<column_name>).{symbol}(...)
|
|
6
|
+
*/
|
|
2
7
|
export declare class ComparisonExpr extends ExprBase {
|
|
8
|
+
/**
|
|
9
|
+
* Checks if values fall inside lower and upper boundaries (inclusive).
|
|
10
|
+
* @param lower The lower boundary value or expression.
|
|
11
|
+
* @param upper The upper boundary value or expression.
|
|
12
|
+
* @param closed Control boundary inclusivity: "both", "left", "right", or "none" (default: "both").
|
|
13
|
+
* @returns ColumnExpression
|
|
14
|
+
* @example
|
|
15
|
+
* >>> df.with_columns($df.col("a").between(1, 2).alias("in_range"))
|
|
16
|
+
* shape: (3, 3)
|
|
17
|
+
* ┌───┬───┬──────────┐
|
|
18
|
+
* │ a │ b │ in_range │
|
|
19
|
+
* ├───┼───┼──────────┤
|
|
20
|
+
* │ 1 │ x │ true │
|
|
21
|
+
* │ 2 │ y │ true │
|
|
22
|
+
* │ 3 │ z │ false │
|
|
23
|
+
* └───┴───┴──────────┘
|
|
24
|
+
*/
|
|
3
25
|
between(lower: any, upper: any, closed?: "both" | "left" | "right" | "none"): this;
|
|
26
|
+
/**
|
|
27
|
+
* Boolean comparison: Returns true if column values match the specified value exactly.
|
|
28
|
+
* @param val The value or column expression to compare against.
|
|
29
|
+
* @returns ColumnExpression
|
|
30
|
+
* @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"))
|
|
44
|
+
* shape: (3, 2)
|
|
45
|
+
* ┌───┬────────┐
|
|
46
|
+
* │ a │ is_two │
|
|
47
|
+
* ├───┼────────┤
|
|
48
|
+
* │ 1 │ false │
|
|
49
|
+
* │ 2 │ true │
|
|
50
|
+
* │ 3 │ false │
|
|
51
|
+
* └───┴────────┘
|
|
52
|
+
*/
|
|
4
53
|
eq(val: any): this;
|
|
54
|
+
/**
|
|
55
|
+
* Equivalence check that treats null values as equal to each other.
|
|
56
|
+
* @param val The value or column expression to compare against.
|
|
57
|
+
* @returns ColumnExpression
|
|
58
|
+
* @example
|
|
59
|
+
* >>> const df = $df.data({ a: [1, null, 3] })
|
|
60
|
+
* >>> df.with_columns($df.col("a").eq_missing(null).alias("is_missing"))
|
|
61
|
+
* shape: (3, 2)
|
|
62
|
+
* ┌──────┬────────────┐
|
|
63
|
+
* │ a │ is_missing │
|
|
64
|
+
* ├──────┼────────────┤
|
|
65
|
+
* │ 1 │ false │
|
|
66
|
+
* │ null │ true │
|
|
67
|
+
* │ 3 │ false │
|
|
68
|
+
* └──────┴────────────┘
|
|
69
|
+
*/
|
|
5
70
|
eq_missing(val: any): this;
|
|
71
|
+
/**
|
|
72
|
+
* Boolean comparison: Returns true if greater than or equal to argument.
|
|
73
|
+
* @param val The value or column expression to compare against.
|
|
74
|
+
* @returns ColumnExpression
|
|
75
|
+
* @example
|
|
76
|
+
* >>> const df = $df.data({ price: [90, 100, 110] })
|
|
77
|
+
* >>> df.with_columns($df.col("price").ge(100).alias("ge_100"))
|
|
78
|
+
* shape: (3, 2)
|
|
79
|
+
* ┌───────┬────────┐
|
|
80
|
+
* │ price │ ge_100 │
|
|
81
|
+
* ├───────┼────────┤
|
|
82
|
+
* │ 90 │ false │
|
|
83
|
+
* │ 100 │ true │
|
|
84
|
+
* │ 110 │ true │
|
|
85
|
+
* └───────┴────────┘
|
|
86
|
+
*/
|
|
6
87
|
ge(val: any): this;
|
|
88
|
+
/**
|
|
89
|
+
* Boolean comparison: Returns true if column value is greater than argument.
|
|
90
|
+
* @param val The value or column expression to compare against.
|
|
91
|
+
* @returns ColumnExpression
|
|
92
|
+
* @example
|
|
93
|
+
* >>> const df = $df.data({ price: [90, 100, 110] })
|
|
94
|
+
* >>> df.with_columns($df.col("price").gt(100).alias("gt_100"))
|
|
95
|
+
* shape: (3, 2)
|
|
96
|
+
* ┌───────┬────────┐
|
|
97
|
+
* │ price │ gt_100 │
|
|
98
|
+
* ├───────┼────────┤
|
|
99
|
+
* │ 90 │ false │
|
|
100
|
+
* │ 100 │ false │
|
|
101
|
+
* │ 110 │ true │
|
|
102
|
+
* └───────┴────────┘
|
|
103
|
+
*/
|
|
7
104
|
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
|
+
*/
|
|
8
118
|
has_nulls(): any;
|
|
119
|
+
/**
|
|
120
|
+
* Determines if floating-point values are approximately equal within tolerances.
|
|
121
|
+
* @param other The value or expression to compare against.
|
|
122
|
+
* @param options Tolerance values absolute (abs_tol) and relative (rel_tol), and NaN options.
|
|
123
|
+
* @returns ColumnExpression
|
|
124
|
+
* @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
|
+
* └─────────────┴───────┘
|
|
134
|
+
*/
|
|
9
135
|
is_close(other: any, { abs_tol, rel_tol, nans_equal }?: {
|
|
10
136
|
abs_tol?: number;
|
|
11
137
|
rel_tol?: number;
|
|
12
138
|
nans_equal?: boolean;
|
|
13
139
|
}): this;
|
|
140
|
+
/**
|
|
141
|
+
* Checks if values occur more than once in the column.
|
|
142
|
+
* @returns ColumnExpression
|
|
143
|
+
* @example
|
|
144
|
+
* >>> const df = $df.data({ a: [1, 2, 2] })
|
|
145
|
+
* >>> df.with_columns($df.col("a").is_duplicated().alias("dup"))
|
|
146
|
+
* shape: (3, 2)
|
|
147
|
+
* ┌───┬───────┐
|
|
148
|
+
* │ a │ dup │
|
|
149
|
+
* ├───┼───────┤
|
|
150
|
+
* │ 1 │ false │
|
|
151
|
+
* │ 2 │ true │
|
|
152
|
+
* │ 2 │ true │
|
|
153
|
+
* └───┴───────┘
|
|
154
|
+
*/
|
|
14
155
|
is_duplicated(): this;
|
|
156
|
+
/**
|
|
157
|
+
* Checks if strings or nested arrays have length 0.
|
|
158
|
+
* @param options Config options including whether to ignore nulls inside arrays.
|
|
159
|
+
* @returns ColumnExpression
|
|
160
|
+
* @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
|
+
* └─────────┴───────┘
|
|
171
|
+
*/
|
|
15
172
|
is_empty({ ignoreNulls }?: {
|
|
16
173
|
ignoreNulls?: boolean;
|
|
17
174
|
}): this;
|
|
175
|
+
/**
|
|
176
|
+
* Checks if values are finite numbers (not NaN or Infinity).
|
|
177
|
+
* @returns ColumnExpression
|
|
178
|
+
* @example
|
|
179
|
+
* >>> const df = $df.data({ a: [1.5, Infinity, NaN] })
|
|
180
|
+
* >>> df.with_columns($df.col("a").is_finite().alias("finite"))
|
|
181
|
+
* shape: (3, 2)
|
|
182
|
+
* ┌──────────┬────────┐
|
|
183
|
+
* │ a │ finite │
|
|
184
|
+
* ├──────────┼────────┤
|
|
185
|
+
* │ 1.5 │ true │
|
|
186
|
+
* │ Infinity │ false │
|
|
187
|
+
* │ NaN │ false │
|
|
188
|
+
* └──────────┴────────┘
|
|
189
|
+
*/
|
|
18
190
|
is_finite(): this;
|
|
191
|
+
/**
|
|
192
|
+
* Checks if column values are members of a specified array or list.
|
|
193
|
+
* @param values An array of candidate values or a single value to match against.
|
|
194
|
+
* @returns ColumnExpression
|
|
195
|
+
* @example
|
|
196
|
+
* >>> const df = $df.data({ category: ["toys", "books", "food"] })
|
|
197
|
+
* >>> df.with_columns($df.col("category").is_in(["toys", "books"]).alias("in_list"))
|
|
198
|
+
* shape: (3, 2)
|
|
199
|
+
* ┌──────────┬─────────┐
|
|
200
|
+
* │ category │ in_list │
|
|
201
|
+
* ├──────────┼─────────┤
|
|
202
|
+
* │ "toys" │ true │
|
|
203
|
+
* │ "books" │ true │
|
|
204
|
+
* │ "food" │ false │
|
|
205
|
+
* └──────────┴─────────┘
|
|
206
|
+
*/
|
|
19
207
|
is_in(values: any[] | any): this;
|
|
208
|
+
/**
|
|
209
|
+
* Checks if values are positive or negative Infinity.
|
|
210
|
+
* @returns ColumnExpression
|
|
211
|
+
* @example
|
|
212
|
+
* >>> const df = $df.data({ a: [1.5, Infinity, -Infinity] })
|
|
213
|
+
* >>> df.with_columns($df.col("a").is_infinite().alias("inf"))
|
|
214
|
+
* shape: (3, 2)
|
|
215
|
+
* ┌───────────┬───────┐
|
|
216
|
+
* │ a │ inf │
|
|
217
|
+
* ├───────────┼───────┤
|
|
218
|
+
* │ 1.5 │ false │
|
|
219
|
+
* │ Infinity │ true │
|
|
220
|
+
* │ -Infinity │ true │
|
|
221
|
+
* └───────────┴───────┘
|
|
222
|
+
*/
|
|
20
223
|
is_infinite(): this;
|
|
224
|
+
/**
|
|
225
|
+
* Checks if values are NaN.
|
|
226
|
+
* @returns ColumnExpression
|
|
227
|
+
* @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
|
+
* └─────┴───────┘
|
|
237
|
+
*/
|
|
21
238
|
is_nan(): this;
|
|
239
|
+
/**
|
|
240
|
+
* Checks if values are not NaN.
|
|
241
|
+
* @returns ColumnExpression
|
|
242
|
+
* @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
|
+
* └─────┴─────────┘
|
|
252
|
+
*/
|
|
22
253
|
is_not_nan(): this;
|
|
254
|
+
/**
|
|
255
|
+
* Checks if column values are non-null and valid (not null, undefined, or missing).
|
|
256
|
+
* @returns ColumnExpression
|
|
257
|
+
* @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
|
+
* └───────────────────┴───────┘
|
|
267
|
+
*/
|
|
23
268
|
is_not_null(): this;
|
|
269
|
+
/**
|
|
270
|
+
* Checks if column values are null, undefined, or missing.
|
|
271
|
+
* @returns ColumnExpression
|
|
272
|
+
* @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
|
+
* └───────────────────┴─────────┘
|
|
282
|
+
*/
|
|
24
283
|
is_null(): this;
|
|
284
|
+
/**
|
|
285
|
+
* Checks if values occur exactly once in the column.
|
|
286
|
+
* @returns ColumnExpression
|
|
287
|
+
* @example
|
|
288
|
+
* >>> const df = $df.data({ a: [1, 2, 2] })
|
|
289
|
+
* >>> df.with_columns($df.col("a").is_unique().alias("uniq"))
|
|
290
|
+
* shape: (3, 2)
|
|
291
|
+
* ┌───┬───────┐
|
|
292
|
+
* │ a │ uniq │
|
|
293
|
+
* ├───┼───────┤
|
|
294
|
+
* │ 1 │ true │
|
|
295
|
+
* │ 2 │ false │
|
|
296
|
+
* │ 2 │ false │
|
|
297
|
+
* └───┴───────┘
|
|
298
|
+
*/
|
|
25
299
|
is_unique(): this;
|
|
300
|
+
/**
|
|
301
|
+
* Boolean comparison: Returns true if less than or equal to argument.
|
|
302
|
+
* @param val The value or column expression to compare against.
|
|
303
|
+
* @returns ColumnExpression
|
|
304
|
+
* @example
|
|
305
|
+
* >>> const df = $df.data({ price: [40, 50, 60] })
|
|
306
|
+
* >>> df.with_columns($df.col("price").le(50).alias("le_50"))
|
|
307
|
+
* shape: (3, 2)
|
|
308
|
+
* ┌───────┬───────┐
|
|
309
|
+
* │ price │ le_50 │
|
|
310
|
+
* ├───────┼───────┤
|
|
311
|
+
* │ 40 │ true │
|
|
312
|
+
* │ 50 │ true │
|
|
313
|
+
* │ 60 │ false │
|
|
314
|
+
* └───────┴───────┘
|
|
315
|
+
*/
|
|
26
316
|
le(val: any): this;
|
|
317
|
+
/**
|
|
318
|
+
* Boolean comparison: Returns true if less than argument.
|
|
319
|
+
* @param val The value or column expression to compare against.
|
|
320
|
+
* @returns ColumnExpression
|
|
321
|
+
* @example
|
|
322
|
+
* >>> const df = $df.data({ price: [40, 50, 60] })
|
|
323
|
+
* >>> df.with_columns($df.col("price").lt(50).alias("lt_50"))
|
|
324
|
+
* shape: (3, 2)
|
|
325
|
+
* ┌───────┬───────┐
|
|
326
|
+
* │ price │ lt_50 │
|
|
327
|
+
* ├───────┼───────┤
|
|
328
|
+
* │ 40 │ true │
|
|
329
|
+
* │ 50 │ false │
|
|
330
|
+
* │ 60 │ false │
|
|
331
|
+
* └───────┴───────┘
|
|
332
|
+
*/
|
|
27
333
|
lt(val: any): this;
|
|
334
|
+
/**
|
|
335
|
+
* Boolean comparison: Returns true if values do not match.
|
|
336
|
+
* @param val The value or column expression to compare against.
|
|
337
|
+
* @returns ColumnExpression
|
|
338
|
+
* @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
|
+
* └─────────────┴──────────┘
|
|
348
|
+
*/
|
|
28
349
|
ne(val: any): this;
|
|
350
|
+
/**
|
|
351
|
+
* Difference check that treats null values as equal to each other.
|
|
352
|
+
* @param val The value or column expression to compare against.
|
|
353
|
+
* @returns ColumnExpression
|
|
354
|
+
* @example
|
|
355
|
+
* >>> const df = $df.data({ a: [1, null, 3] })
|
|
356
|
+
* >>> df.with_columns($df.col("a").ne_missing(null).alias("not_missing"))
|
|
357
|
+
* shape: (3, 2)
|
|
358
|
+
* ┌──────┬─────────────┐
|
|
359
|
+
* │ a │ not_missing │
|
|
360
|
+
* ├──────┼─────────────┤
|
|
361
|
+
* │ 1 │ true │
|
|
362
|
+
* │ null │ false │
|
|
363
|
+
* │ 3 │ true │
|
|
364
|
+
* └──────┴─────────────┘
|
|
365
|
+
*/
|
|
29
366
|
ne_missing(val: any): this;
|
|
367
|
+
/**
|
|
368
|
+
* Checks if values are not elements of a specific array or set list.
|
|
369
|
+
* @param values An array of candidate values or a single value to match against.
|
|
370
|
+
* @returns ColumnExpression
|
|
371
|
+
* @example
|
|
372
|
+
* >>> const df = $df.data({ category: ["toys", "books", "food"] })
|
|
373
|
+
* >>> df.with_columns($df.col("category").not_in(["toys", "books"]).alias("not_in"))
|
|
374
|
+
* shape: (3, 2)
|
|
375
|
+
* ┌──────────┬────────┐
|
|
376
|
+
* │ category │ not_in │
|
|
377
|
+
* ├──────────┼────────┤
|
|
378
|
+
* │ toys │ false │
|
|
379
|
+
* │ books │ false │
|
|
380
|
+
* │ food │ true │
|
|
381
|
+
* └──────────┴────────┘
|
|
382
|
+
*/
|
|
30
383
|
not_in(values: any[] | any): this;
|
|
31
384
|
}
|
|
@@ -1,7 +1,89 @@
|
|
|
1
1
|
import { ExprBase } from "../ExprBase";
|
|
2
|
+
/**
|
|
3
|
+
* @namespace $df.col
|
|
4
|
+
* @category ColumnExpression
|
|
5
|
+
* @syntax $df.col(<column_name>).{symbol}(...)
|
|
6
|
+
*/
|
|
2
7
|
export declare class LogicalExpr extends ExprBase {
|
|
8
|
+
/**
|
|
9
|
+
* Logical AND check supporting Kleene logic.
|
|
10
|
+
* @param other The other boolean column expression or literal value to compare.
|
|
11
|
+
* @returns ColumnExpression
|
|
12
|
+
* @example
|
|
13
|
+
* >>> const df = $df.data({
|
|
14
|
+
* ... a: [true, true, false, null],
|
|
15
|
+
* ... b: [true, false, false, true]
|
|
16
|
+
* ... })
|
|
17
|
+
* >>> df.with_columns($df.col("a").and($df.col("b")).alias("and_res"))
|
|
18
|
+
* shape: (4, 3)
|
|
19
|
+
* ┌───────┬───────┬─────────┐
|
|
20
|
+
* │ a │ b │ and_res │
|
|
21
|
+
* ├───────┼───────┼─────────┤
|
|
22
|
+
* │ true │ true │ true │
|
|
23
|
+
* │ true │ false │ false │
|
|
24
|
+
* │ false │ false │ false │
|
|
25
|
+
* │ null │ true │ null │
|
|
26
|
+
* └───────┴───────┴─────────┘
|
|
27
|
+
*/
|
|
3
28
|
and(other: any): this;
|
|
29
|
+
/**
|
|
30
|
+
* Logical negation.
|
|
31
|
+
* @returns ColumnExpression
|
|
32
|
+
* @example
|
|
33
|
+
* >>> const df = $df.data({
|
|
34
|
+
* ... is_active: [true, false, null]
|
|
35
|
+
* ... })
|
|
36
|
+
* >>> df.with_columns($df.col("is_active").not().alias("is_inactive"))
|
|
37
|
+
* shape: (3, 2)
|
|
38
|
+
* ┌───────────┬─────────────┐
|
|
39
|
+
* │ is_active │ is_inactive │
|
|
40
|
+
* ├───────────┼─────────────┤
|
|
41
|
+
* │ true │ false │
|
|
42
|
+
* │ false │ true │
|
|
43
|
+
* │ null │ null │
|
|
44
|
+
* └───────────┴─────────────┘
|
|
45
|
+
*/
|
|
4
46
|
not(): this;
|
|
47
|
+
/**
|
|
48
|
+
* Logical OR check supporting Kleene logic.
|
|
49
|
+
* @param other The other boolean column expression or literal value to compare.
|
|
50
|
+
* @returns ColumnExpression
|
|
51
|
+
* @example
|
|
52
|
+
* >>> const df = $df.data({
|
|
53
|
+
* ... a: [true, false, false, null],
|
|
54
|
+
* ... b: [false, false, true, false]
|
|
55
|
+
* ... })
|
|
56
|
+
* >>> df.with_columns($df.col("a").or($df.col("b")).alias("or_res"))
|
|
57
|
+
* shape: (4, 3)
|
|
58
|
+
* ┌───────┬───────┬────────┐
|
|
59
|
+
* │ a │ b │ or_res │
|
|
60
|
+
* ├───────┼───────┼────────┤
|
|
61
|
+
* │ true │ false │ true │
|
|
62
|
+
* │ false │ false │ false │
|
|
63
|
+
* │ false │ true │ true │
|
|
64
|
+
* │ null │ false │ null │
|
|
65
|
+
* └───────┴───────┴────────┘
|
|
66
|
+
*/
|
|
5
67
|
or(other: any): this;
|
|
68
|
+
/**
|
|
69
|
+
* Logical XOR check.
|
|
70
|
+
* @param other The other boolean column expression or literal value to compare.
|
|
71
|
+
* @returns ColumnExpression
|
|
72
|
+
* @example
|
|
73
|
+
* >>> const df = $df.data({
|
|
74
|
+
* ... a: [true, true, false, false],
|
|
75
|
+
* ... b: [true, false, true, false]
|
|
76
|
+
* ... })
|
|
77
|
+
* >>> df.with_columns($df.col("a").xor($df.col("b")).alias("xor_res"))
|
|
78
|
+
* shape: (4, 3)
|
|
79
|
+
* ┌───────┬───────┬─────────┐
|
|
80
|
+
* │ a │ b │ xor_res │
|
|
81
|
+
* ├───────┼───────┼─────────┤
|
|
82
|
+
* │ true │ true │ false │
|
|
83
|
+
* │ true │ false │ true │
|
|
84
|
+
* │ false │ true │ true │
|
|
85
|
+
* │ false │ false │ false │
|
|
86
|
+
* └───────┴───────┴─────────┘
|
|
87
|
+
*/
|
|
6
88
|
xor(other: any): this;
|
|
7
89
|
}
|
|
@@ -1,6 +1,46 @@
|
|
|
1
1
|
import { ExprBase } from "../ExprBase";
|
|
2
2
|
import type { FillNullOptions } from "../../types";
|
|
3
|
+
/**
|
|
4
|
+
* @namespace $df.col
|
|
5
|
+
* @category ColumnExpression
|
|
6
|
+
* @syntax $df.col(<column_name>).{symbol}(...)
|
|
7
|
+
*/
|
|
3
8
|
export declare class ManipulationExpr extends ExprBase {
|
|
9
|
+
/**
|
|
10
|
+
* Replaces null, undefined, or missing values with a specified value or strategy.
|
|
11
|
+
* @param options Configuration options including fill value, strategy ("forward", "backward", "zero", "one", "mean", "min", "max"), and optional limit.
|
|
12
|
+
* @returns ColumnExpression
|
|
13
|
+
* @example
|
|
14
|
+
* >>> const df = $df.data({
|
|
15
|
+
* ... a: [1, null, 3]
|
|
16
|
+
* ... })
|
|
17
|
+
* >>> df.with_columns($df.col("a").fill_null({ value: 0 }).alias("filled"))
|
|
18
|
+
* shape: (3, 2)
|
|
19
|
+
* ┌──────┬────────┐
|
|
20
|
+
* │ a │ filled │
|
|
21
|
+
* ├──────┼────────┤
|
|
22
|
+
* │ 1 │ 1 │
|
|
23
|
+
* │ null │ 0 │
|
|
24
|
+
* │ 3 │ 3 │
|
|
25
|
+
* └──────┴────────┘
|
|
26
|
+
*/
|
|
4
27
|
fill_null({ value, strategy, limit }?: FillNullOptions): this;
|
|
28
|
+
/**
|
|
29
|
+
* Reverses the order of values in the column.
|
|
30
|
+
* @returns ColumnExpression
|
|
31
|
+
* @example
|
|
32
|
+
* >>> const df = $df.data({
|
|
33
|
+
* ... a: [1, 2, 3]
|
|
34
|
+
* ... })
|
|
35
|
+
* >>> df.with_columns($df.col("a").reverse().alias("reversed"))
|
|
36
|
+
* shape: (3, 2)
|
|
37
|
+
* ┌───┬──────────┐
|
|
38
|
+
* │ a │ reversed │
|
|
39
|
+
* ├───┼──────────┤
|
|
40
|
+
* │ 1 │ 3 │
|
|
41
|
+
* │ 2 │ 2 │
|
|
42
|
+
* │ 3 │ 1 │
|
|
43
|
+
* └───┴──────────┘
|
|
44
|
+
*/
|
|
5
45
|
reverse(): this;
|
|
6
46
|
}
|