@ohos-ports/nodejs-polars 0.22.2-beta.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 (71) hide show
  1. package/LICENSE +19 -0
  2. package/README.md +217 -0
  3. package/bin/cfg.d.ts +156 -0
  4. package/bin/cfg.js +52 -0
  5. package/bin/dataframe.d.ts +2008 -0
  6. package/bin/dataframe.js +771 -0
  7. package/bin/datatypes/conversion.d.ts +2 -0
  8. package/bin/datatypes/conversion.js +2 -0
  9. package/bin/datatypes/datatype.d.ts +252 -0
  10. package/bin/datatypes/datatype.js +386 -0
  11. package/bin/datatypes/field.d.ts +26 -0
  12. package/bin/datatypes/field.js +36 -0
  13. package/bin/datatypes/index.d.ts +42 -0
  14. package/bin/datatypes/index.js +119 -0
  15. package/bin/error.d.ts +7 -0
  16. package/bin/error.js +17 -0
  17. package/bin/functions.d.ts +26 -0
  18. package/bin/functions.js +208 -0
  19. package/bin/groupby.d.ts +173 -0
  20. package/bin/groupby.js +156 -0
  21. package/bin/html.d.ts +4 -0
  22. package/bin/html.js +18 -0
  23. package/bin/index.d.ts +252 -0
  24. package/bin/index.js +265 -0
  25. package/bin/internals/construction.d.ts +7 -0
  26. package/bin/internals/construction.js +237 -0
  27. package/bin/internals/polars_internal.d.ts +2 -0
  28. package/bin/internals/polars_internal.js +7 -0
  29. package/bin/io.d.ts +421 -0
  30. package/bin/io.js +332 -0
  31. package/bin/lazy/dataframe.d.ts +693 -0
  32. package/bin/lazy/dataframe.js +421 -0
  33. package/bin/lazy/expr/datetime.d.ts +8 -0
  34. package/bin/lazy/expr/datetime.js +25 -0
  35. package/bin/lazy/expr/index.d.ts +1155 -0
  36. package/bin/lazy/expr/index.js +629 -0
  37. package/bin/lazy/expr/list.d.ts +8 -0
  38. package/bin/lazy/expr/list.js +115 -0
  39. package/bin/lazy/expr/string.d.ts +534 -0
  40. package/bin/lazy/expr/string.js +131 -0
  41. package/bin/lazy/expr/struct.d.ts +126 -0
  42. package/bin/lazy/expr/struct.js +26 -0
  43. package/bin/lazy/functions.d.ts +620 -0
  44. package/bin/lazy/functions.js +691 -0
  45. package/bin/lazy/groupby.d.ts +24 -0
  46. package/bin/lazy/groupby.js +22 -0
  47. package/bin/lazy/index.d.ts +4 -0
  48. package/bin/lazy/index.js +20 -0
  49. package/bin/lazy/whenthen.d.ts +67 -0
  50. package/bin/lazy/whenthen.js +81 -0
  51. package/bin/native-polars.d.ts +2 -0
  52. package/bin/native-polars.js +267 -0
  53. package/bin/series/datetime.d.ts +8 -0
  54. package/bin/series/datetime.js +25 -0
  55. package/bin/series/index.d.ts +1116 -0
  56. package/bin/series/index.js +689 -0
  57. package/bin/series/list.d.ts +8 -0
  58. package/bin/series/list.js +87 -0
  59. package/bin/series/string.d.ts +300 -0
  60. package/bin/series/string.js +125 -0
  61. package/bin/series/struct.d.ts +36 -0
  62. package/bin/series/struct.js +35 -0
  63. package/bin/shared_traits.d.ts +1325 -0
  64. package/bin/shared_traits.js +2 -0
  65. package/bin/sql.d.ts +244 -0
  66. package/bin/sql.js +63 -0
  67. package/bin/types.d.ts +284 -0
  68. package/bin/types.js +2 -0
  69. package/bin/utils.d.ts +38 -0
  70. package/bin/utils.js +69 -0
  71. package/package.json +51 -0
@@ -0,0 +1,620 @@
1
+ import { DataFrame } from "../dataframe";
2
+ import { DataType } from "../datatypes";
3
+ import { Series } from "../series";
4
+ import { type ExprOrString } from "../utils";
5
+ import { Expr } from "./expr";
6
+ /**
7
+ * __A column in a DataFrame.__
8
+ * Can be used to select:
9
+ * * a single column by name
10
+ * * all columns by using a wildcard `"*"`
11
+ * * column by regular expression if the regex starts with `^` and ends with `$`
12
+ * @param col
13
+ * @example
14
+ * ```
15
+ * > df = pl.DataFrame({
16
+ * > "ham": [1, 2, 3],
17
+ * > "hamburger": [11, 22, 33],
18
+ * > "foo": [3, 2, 1]})
19
+ * > df.select(col("foo"))
20
+ * shape: (3, 1)
21
+ * ╭─────╮
22
+ * │ foo │
23
+ * │ --- │
24
+ * │ i64 │
25
+ * ╞═════╡
26
+ * │ 3 │
27
+ * ├╌╌╌╌╌┤
28
+ * │ 2 │
29
+ * ├╌╌╌╌╌┤
30
+ * │ 1 │
31
+ * ╰─────╯
32
+ * > df.select(col("*"))
33
+ * shape: (3, 3)
34
+ * ╭─────┬───────────┬─────╮
35
+ * │ ham ┆ hamburger ┆ foo │
36
+ * │ --- ┆ --- ┆ --- │
37
+ * │ i64 ┆ i64 ┆ i64 │
38
+ * ╞═════╪═══════════╪═════╡
39
+ * │ 1 ┆ 11 ┆ 3 │
40
+ * ├╌╌╌╌╌┼╌╌╌╌╌╌╌╌╌╌╌┼╌╌╌╌╌┤
41
+ * │ 2 ┆ 22 ┆ 2 │
42
+ * ├╌╌╌╌╌┼╌╌╌╌╌╌╌╌╌╌╌┼╌╌╌╌╌┤
43
+ * │ 3 ┆ 33 ┆ 1 │
44
+ * ╰─────┴───────────┴─────╯
45
+ * > df.select(col("^ham.*$"))
46
+ * shape: (3, 2)
47
+ * ╭─────┬───────────╮
48
+ * │ ham ┆ hamburger │
49
+ * │ --- ┆ --- │
50
+ * │ i64 ┆ i64 │
51
+ * ╞═════╪═══════════╡
52
+ * │ 1 ┆ 11 │
53
+ * ├╌╌╌╌╌┼╌╌╌╌╌╌╌╌╌╌╌┤
54
+ * │ 2 ┆ 22 │
55
+ * ├╌╌╌╌╌┼╌╌╌╌╌╌╌╌╌╌╌┤
56
+ * │ 3 ┆ 33 │
57
+ * ╰─────┴───────────╯
58
+ * > df.select(col("*").exclude("ham"))
59
+ * shape: (3, 2)
60
+ * ╭───────────┬─────╮
61
+ * │ hamburger ┆ foo │
62
+ * │ --- ┆ --- │
63
+ * │ i64 ┆ i64 │
64
+ * ╞═══════════╪═════╡
65
+ * │ 11 ┆ 3 │
66
+ * ├╌╌╌╌╌╌╌╌╌╌╌┼╌╌╌╌╌┤
67
+ * │ 22 ┆ 2 │
68
+ * ├╌╌╌╌╌╌╌╌╌╌╌┼╌╌╌╌╌┤
69
+ * │ 33 ┆ 1 │
70
+ * ╰───────────┴─────╯
71
+ * > df.select(col(["hamburger", "foo"])
72
+ * shape: (3, 2)
73
+ * ╭───────────┬─────╮
74
+ * │ hamburger ┆ foo │
75
+ * │ --- ┆ --- │
76
+ * │ i64 ┆ i64 │
77
+ * ╞═══════════╪═════╡
78
+ * │ 11 ┆ 3 │
79
+ * ├╌╌╌╌╌╌╌╌╌╌╌┼╌╌╌╌╌┤
80
+ * │ 22 ┆ 2 │
81
+ * ├╌╌╌╌╌╌╌╌╌╌╌┼╌╌╌╌╌┤
82
+ * │ 33 ┆ 1 │
83
+ * ╰───────────┴─────╯
84
+ * > df.select(col(pl.Series(["hamburger", "foo"]))
85
+ * shape: (3, 2)
86
+ * ╭───────────┬─────╮
87
+ * │ hamburger ┆ foo │
88
+ * │ --- ┆ --- │
89
+ * │ i64 ┆ i64 │
90
+ * ╞═══════════╪═════╡
91
+ * │ 11 ┆ 3 │
92
+ * ├╌╌╌╌╌╌╌╌╌╌╌┼╌╌╌╌╌┤
93
+ * │ 22 ┆ 2 │
94
+ * ├╌╌╌╌╌╌╌╌╌╌╌┼╌╌╌╌╌┤
95
+ * │ 33 ┆ 1 │
96
+ * ╰───────────┴─────╯
97
+ * ```
98
+ */
99
+ export declare function col(col: string | string[] | Series | DataType): Expr;
100
+ export declare function cols(col: string | string[]): Expr;
101
+ export declare function cols(col: string, ...cols2: string[]): Expr;
102
+ /**
103
+ * Select nth column index in a DataFrame.
104
+ * @param n - Column index to select, starting at 0.
105
+ * @example
106
+ * ```
107
+ * > df = pl.DataFrame({
108
+ * > "ham": [1, 2, 3],
109
+ * > "hamburger": [11, 22, 33],
110
+ * > "foo": [3, 2, 1]})
111
+ * > df.select(nth(2))
112
+ * shape: (3, 1)
113
+ * ╭─────╮
114
+ * │ foo │
115
+ * │ --- │
116
+ * │ i64 │
117
+ * ╞═════╡
118
+ * │ 3 │
119
+ * ├╌╌╌╌╌┤
120
+ * │ 2 │
121
+ * ├╌╌╌╌╌┤
122
+ * │ 1 │
123
+ * ╰─────╯
124
+ * ```
125
+ */
126
+ export declare function nth(n: number): Expr;
127
+ export declare function lit(value: any): Expr;
128
+ /**
129
+ * Generate a range of integers.
130
+ *
131
+ * This can be used in a `select`, `with_column` etc.
132
+ * Be sure that the range size is equal to the DataFrame you are collecting.
133
+ * @param start - Start of the range (inclusive). Defaults to 0.
134
+ * @param end - End of the range (exclusive). If set to `None` (default), the value of `start` is used and `start` is set to `0`.
135
+ * @param step - Step size of the range.
136
+ * @param dtype - Data type of the range.
137
+ * @param eager - Evaluate immediately and return a `Series`. If set to `False` (default), return an expression instead.
138
+ * @returns Expr or Series Column of integer data type `dtype`.
139
+ * @see {@link intRanges}
140
+ * @example
141
+ * ```
142
+ * > df.lazy()
143
+ * > .filter(pl.col("foo").lt(pl.intRange(0, 100)))
144
+ * > .collect()
145
+ * ```
146
+ *
147
+ *
148
+ * Generate an index column by using `intRange` in conjunction with :func:`len`.
149
+ * ```
150
+ * df = pl.DataFrame({"a": [1, 3, 5], "b": [2, 4, 6]})
151
+ df.select(
152
+ ... pl.intRange(pl.len()).alias("index"),
153
+ ... pl.all(),
154
+ ... )
155
+ shape: (3, 3)
156
+ ┌───────┬─────┬─────┐
157
+ │ index ┆ a ┆ b │
158
+ │ --- ┆ --- ┆ --- │
159
+ │ u32 ┆ i64 ┆ i64 │
160
+ ╞═══════╪═════╪═════╡
161
+ │ 0 ┆ 1 ┆ 2 │
162
+ │ 1 ┆ 3 ┆ 4 │
163
+ │ 2 ┆ 5 ┆ 6 │
164
+ └───────┴─────┴─────┘
165
+ * ```
166
+ */
167
+ export declare function intRange(start: number | Expr, end?: number | Expr, step?: number | Expr, dtype?: DataType, eager?: false): Expr;
168
+ export declare function intRange<DT extends DataType = DataType.Int64>(opts: {
169
+ start: number | Expr;
170
+ end: number | Expr;
171
+ step?: number | Expr;
172
+ dtype?: DT;
173
+ eager: true;
174
+ }): Series<DT>;
175
+ export declare function intRange(opts: {
176
+ start: number | Expr;
177
+ end: number | Expr;
178
+ step?: number | Expr;
179
+ dtype?: DataType;
180
+ eager?: false;
181
+ }): Expr;
182
+ export declare function intRange<DT extends DataType = DataType.Int64>(opts: {
183
+ start: number | Expr;
184
+ end: number | Expr;
185
+ step?: number | Expr;
186
+ dtype?: DT;
187
+ eager?: boolean;
188
+ }): Expr | Series<DT>;
189
+ /** @deprecated *since 0.15.0* use `start` and `end` instead */
190
+ export declare function intRange(opts: {
191
+ low: number | Expr;
192
+ high: number | Expr;
193
+ step?: number | Expr;
194
+ dtype?: DataType;
195
+ eager?: boolean;
196
+ }): Expr | Series;
197
+ export declare function intRange<DT extends DataType = DataType.Int64>(start: number | Expr, end?: number | Expr, step?: number | Expr, dtype?: DT, eager?: true): Series<DT>;
198
+ /***
199
+ * Generate a range of integers for each row of the input columns.
200
+ * @param start - Start of the range (inclusive). Defaults to 0.
201
+ * @param end - End of the range (exclusive). If set to `None` (default), the value of `start` is used and `start` is set to `0`.
202
+ * @param step - Step size of the range.
203
+ * @param dtype - Integer data type of the ranges. Defaults to `Int64`.
204
+ * @param eager - Evaluate immediately and return a ``Series``. If set to ``False`` (default), return an expression instead.
205
+ * @return - Expr or Series Column of data type `List(dtype)`.
206
+ * @see {@link intRange}
207
+ * @example
208
+ * ```
209
+ * const df = pl.DataFrame({"a": [1, 2], "b": [3, 4]})
210
+ * const result = df.select(pl.intRanges("a", "b"));
211
+ * ```
212
+ */
213
+ export declare function intRanges(start: any, end: any, step?: number, dtype?: DataType, eager?: false): Expr;
214
+ export declare function intRanges(start: any, end: any, step?: number, dtype?: DataType, eager?: true): Series;
215
+ /** Alias for `pl.col("*")` */
216
+ export declare function all(): Expr;
217
+ /**
218
+ * Return the row indices that would sort the columns.
219
+ * @param exprs Column(s) to arg sort by. Accepts expression input.
220
+ * @param descending Sort in descending order. When sorting by multiple columns, can be specified per column by passing a sequence of booleans.
221
+ * @example
222
+ * ```
223
+ * const df = pl.DataFrame({"a": [0, 1, 1, 0], "b": [3, 2, 3, 2],});
224
+ * df.select(pl.argSortBy(pl.col("a")));
225
+ * shape: (4, 1)
226
+ * ┌─────┐
227
+ * │ a │
228
+ * │ --- │
229
+ * │ u32 │
230
+ * ╞═════╡
231
+ * │ 0 │
232
+ * │ 3 │
233
+ * │ 1 │
234
+ * │ 2 │
235
+ * └─────┘
236
+ * ```
237
+ */
238
+ export declare function argSortBy(exprs: Expr[] | string[], descending?: boolean | boolean[]): Expr;
239
+ /** Alias for mean. @see {@link mean} */
240
+ export declare function avg(column: string): Expr;
241
+ export declare function avg(column: Series): number;
242
+ /**
243
+ * Concat the arrays in a Series dtype List in linear time.
244
+ * @param exprs Columns to concat into a List Series
245
+ */
246
+ export declare function concatList(exprs: ExprOrString[]): Expr;
247
+ export declare function concatList(expr: ExprOrString, ...exprs: ExprOrString[]): Expr;
248
+ export declare function concatList(expr: ExprOrString, expr2: ExprOrString, ...exprs: ExprOrString[]): Expr;
249
+ /** Concat Utf8 Series in linear time. Non utf8 columns are cast to utf8. */
250
+ export declare function concatString(opts: {
251
+ exprs: ExprOrString[];
252
+ sep: string;
253
+ ignoreNulls?: boolean;
254
+ }): any;
255
+ export declare function concatString(exprs: ExprOrString[], sep?: string, ignoreNulls?: boolean): any;
256
+ /** Count the number of values in this column. */
257
+ export declare function count(column: string): Expr;
258
+ export declare function count(column: Series): number;
259
+ /** Compute the covariance between two columns/ expressions. */
260
+ export declare function cov(a: ExprOrString, b: ExprOrString, ddof?: number): Expr;
261
+ /**
262
+ * Exclude certain columns from a wildcard expression.
263
+ *
264
+ * Syntactic sugar for:
265
+ * ```
266
+ * > pl.col("*").exclude(columns)
267
+ * ```
268
+ */
269
+ export declare function exclude(columns: string[] | string): Expr;
270
+ export declare function exclude(col: string, ...cols: string[]): Expr;
271
+ /** Get the first value. */
272
+ export declare function first(): Expr;
273
+ export declare function first(column: string): Expr;
274
+ export declare function first<T>(column: Series): T;
275
+ /**
276
+ * String format utility for expressions
277
+ * Note: strings will be interpolated as `col(<value>)`. if you want a literal string, use `lit(<value>)`
278
+ * @example
279
+ * ```
280
+ * > df = pl.DataFrame({
281
+ * ... "a": ["a", "b", "c"],
282
+ * ... "b": [1, 2, 3],
283
+ * ... })
284
+ * > df.select(
285
+ * ... pl.format("foo_{}_bar_{}", pl.col("a"), "b").alias("fmt"),
286
+ * ... )
287
+ * shape: (3, 1)
288
+ * ┌─────────────┐
289
+ * │ fmt │
290
+ * │ --- │
291
+ * │ str │
292
+ * ╞═════════════╡
293
+ * │ foo_a_bar_1 │
294
+ * ├╌╌╌╌╌╌╌╌╌╌╌╌╌┤
295
+ * │ foo_b_bar_2 │
296
+ * ├╌╌╌╌╌╌╌╌╌╌╌╌╌┤
297
+ * │ foo_c_bar_3 │
298
+ * └─────────────┘
299
+ *
300
+ * // You can use format as tag function as well
301
+ * > pl.format("foo_{}_bar_{}", pl.col("a"), "b") // is the same as
302
+ * > pl.format`foo_${pl.col("a")}_bar_${"b"}`
303
+ * ```
304
+ */
305
+ export declare function format(strings: string | TemplateStringsArray, ...expr: ExprOrString[]): Expr;
306
+ /** Syntactic sugar for `pl.col(column).aggGroups()` */
307
+ export declare function groups(column: string): Expr;
308
+ /** Get the first n rows of an Expression. */
309
+ export declare function head(column: ExprOrString, n?: number): Expr;
310
+ export declare function head(column: Series, n?: number): Series;
311
+ /** Return the number of elements in the column.
312
+ This is similar to `COUNT(*)` in SQL.
313
+
314
+ @return Expr - Expression of data type :class:`UInt32`.
315
+ @example
316
+ ```
317
+ >>> const df = pl.DataFrame(
318
+ ... {
319
+ ... "a": [1, 2, None],
320
+ ... "b": [3, None, None],
321
+ ... "c": ["foo", "bar", "foo"],
322
+ ... }
323
+ ... )
324
+ >>> df.select(pl.len())
325
+ shape: (1, 1)
326
+ ┌─────┐
327
+ │ len │
328
+ │ --- │
329
+ │ u32 │
330
+ ╞═════╡
331
+ │ 3 │
332
+ └─────┘
333
+ ```
334
+ Generate an index column by using `len` in conjunction with :func:`intRange`.
335
+
336
+ ```
337
+ >>> df.select(
338
+ ... pl.intRange(pl.len(), dtype=pl.UInt32).alias("index"),
339
+ ... pl.all(),
340
+ ... )
341
+ shape: (3, 4)
342
+ ┌───────┬──────┬──────┬─────┐
343
+ │ index ┆ a ┆ b ┆ c │
344
+ │ --- ┆ --- ┆ --- ┆ --- │
345
+ │ u32 ┆ i64 ┆ i64 ┆ str │
346
+ ╞═══════╪══════╪══════╪═════╡
347
+ │ 0 ┆ 1 ┆ 3 ┆ foo │
348
+ │ 1 ┆ 2 ┆ null ┆ bar │
349
+ │ 2 ┆ null ┆ null ┆ foo │
350
+ └───────┴──────┴──────┴─────┘
351
+ ```
352
+ */
353
+ export declare function len(): Expr;
354
+ /** Get the last value. */
355
+ export declare function last(column: ExprOrString | Series): any;
356
+ /** Get the mean value. */
357
+ export declare function mean(column: ExprOrString): Expr;
358
+ export declare function mean(column: Series): number;
359
+ /** Get the median value. */
360
+ export declare function median(column: ExprOrString): Expr;
361
+ export declare function median(column: Series): number;
362
+ /** Count unique values. */
363
+ export declare function nUnique(column: ExprOrString): Expr;
364
+ export declare function nUnique(column: Series): number;
365
+ /** Compute the pearson's correlation between two columns. */
366
+ export declare function pearsonCorr(a: ExprOrString, b: ExprOrString): Expr;
367
+ /** Get the quantile */
368
+ export declare function quantile(column: ExprOrString, q: number): Expr;
369
+ export declare function quantile(column: Series, q: number): number;
370
+ /**
371
+ * __Run polars expressions without a context.__
372
+ *
373
+ * This is syntactic sugar for running `df.select` on an empty DataFrame.
374
+ */
375
+ export declare function select(expr: ExprOrString, ...exprs: ExprOrString[]): DataFrame<{}>;
376
+ /** Compute the spearman rank correlation between two columns. */
377
+ export declare function spearmanRankCorr(a: ExprOrString, b: ExprOrString): Expr;
378
+ /** Get the last n rows of an Expression. */
379
+ export declare function tail(column: ExprOrString, n?: number): Expr;
380
+ export declare function tail(column: Series, n?: number): Series;
381
+ /** Syntactic sugar for `pl.col(column).list()` */
382
+ export declare function list(column: ExprOrString): Expr;
383
+ /**
384
+ Collect several columns into a Series of dtype Struct
385
+ Parameters
386
+ ----------
387
+ @param exprs Columns/Expressions to collect into a Struct
388
+ Examples
389
+ --------
390
+ ```
391
+ >pl.DataFrame(
392
+ ... {
393
+ ... "int": [1, 2],
394
+ ... "str": ["a", "b"],
395
+ ... "bool": [True, None],
396
+ ... "list": [[1, 2], [3]],
397
+ ... }
398
+ ... ).select([pl.struct(pl.all()).alias("my_struct")])
399
+ shape: (2, 1)
400
+ ┌───────────────────────┐
401
+ │ my_struct │
402
+ │ --- │
403
+ │ struct{int, ... list} │
404
+ ╞═══════════════════════╡
405
+ │ {1,"a",true,[1, 2]} │
406
+ ├╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌┤
407
+ │ {2,"b",null,[3]} │
408
+ └───────────────────────┘
409
+
410
+ // Only collect specific columns as a struct:
411
+ >df = pl.DataFrame({
412
+ ... "a": [1, 2, 3, 4],
413
+ ... "b": ["one", "two", "three", "four"],
414
+ ... "c": [9, 8, 7, 6]
415
+ ... })
416
+ >df.withColumn(pl.struct(pl.col(["a", "b"])).alias("a_and_b"))
417
+ shape: (4, 4)
418
+ ┌─────┬───────┬─────┬───────────────────────────────┐
419
+ │ a ┆ b ┆ c ┆ a_and_b │
420
+ │ --- ┆ --- ┆ --- ┆ --- │
421
+ │ i64 ┆ str ┆ i64 ┆ struct[2]{'a': i64, 'b': str} │
422
+ ╞═════╪═══════╪═════╪═══════════════════════════════╡
423
+ │ 1 ┆ one ┆ 9 ┆ {1,"one"} │
424
+ ├╌╌╌╌╌┼╌╌╌╌╌╌╌┼╌╌╌╌╌┼╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌┤
425
+ │ 2 ┆ two ┆ 8 ┆ {2,"two"} │
426
+ ├╌╌╌╌╌┼╌╌╌╌╌╌╌┼╌╌╌╌╌┼╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌┤
427
+ │ 3 ┆ three ┆ 7 ┆ {3,"three"} │
428
+ ├╌╌╌╌╌┼╌╌╌╌╌╌╌┼╌╌╌╌╌┼╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌┤
429
+ │ 4 ┆ four ┆ 6 ┆ {4,"four"} │
430
+ └─────┴───────┴─────┴───────────────────────────────┘
431
+ ```
432
+ */
433
+ export declare function struct(exprs: Series[]): Series;
434
+ export declare function struct(exprs: ExprOrString | ExprOrString[]): Expr;
435
+ /**
436
+ * Alias for an element in evaluated in an `eval` expression.
437
+
438
+ * @example
439
+ *
440
+ * A horizontal rank computation by taking the elements of a list
441
+ *
442
+ * >df = pl.DataFrame({"a": [1, 8, 3], "b": [4, 5, 2]})
443
+ * >df.withColumn(
444
+ * ... pl.concatList(["a", "b"]).arr.eval(pl.element().rank()).alias("rank")
445
+ * ... )
446
+ * shape: (3, 3)
447
+ * ┌─────┬─────┬────────────┐
448
+ * │ a ┆ b ┆ rank │
449
+ * │ --- ┆ --- ┆ --- │
450
+ * │ i64 ┆ i64 ┆ list[f32] │
451
+ * ╞═════╪═════╪════════════╡
452
+ * │ 1 ┆ 4 ┆ [1.0, 2.0] │
453
+ * ├╌╌╌╌╌┼╌╌╌╌╌┼╌╌╌╌╌╌╌╌╌╌╌╌┤
454
+ * │ 8 ┆ 5 ┆ [2.0, 1.0] │
455
+ * ├╌╌╌╌╌┼╌╌╌╌╌┼╌╌╌╌╌╌╌╌╌╌╌╌┤
456
+ * │ 3 ┆ 2 ┆ [2.0, 1.0] │
457
+ * └─────┴─────┴────────────┘
458
+ *
459
+ * A mathematical operation on array elements
460
+ *
461
+ * >df = pl.DataFrame({"a": [1, 8, 3], "b": [4, 5, 2]})
462
+ * >df.withColumn(
463
+ * ... pl.concatList(["a", "b"]).arr.eval(pl.element().multiplyBy(2)).alias("a_b_doubled")
464
+ * ... )
465
+ * shape: (3, 3)
466
+ * ┌─────┬─────┬─────────────┐
467
+ * │ a ┆ b ┆ a_b_doubled │
468
+ * │ --- ┆ --- ┆ --- │
469
+ * │ i64 ┆ i64 ┆ list[i64] │
470
+ * ╞═════╪═════╪═════════════╡
471
+ * │ 1 ┆ 4 ┆ [2, 8] │
472
+ * ├╌╌╌╌╌┼╌╌╌╌╌┼╌╌╌╌╌╌╌╌╌╌╌╌╌┤
473
+ * │ 8 ┆ 5 ┆ [16, 10] │
474
+ * ├╌╌╌╌╌┼╌╌╌╌╌┼╌╌╌╌╌╌╌╌╌╌╌╌╌┤
475
+ * │ 3 ┆ 2 ┆ [6, 4] │
476
+ * └─────┴─────┴─────────────┘
477
+ */
478
+ export declare function element(): Expr;
479
+ /**
480
+ * Compute the bitwise AND horizontally across columns.
481
+ * @param exprs
482
+ * Column(s) to use in the aggregation. Accepts expression input. Strings are
483
+ * parsed as column names, other non-expression inputs are parsed as literals.
484
+ *
485
+ * @example
486
+ * ```
487
+ * >>> const df = pl.DataFrame(
488
+ * {
489
+ * "a": [false, false, true, true],
490
+ * "b": [false, true, null, true],
491
+ * "c": ["w", "x", "y", "z"],
492
+ * }
493
+ * )
494
+ * >>> df.withColumns(pl.allHorizontal([pl.col("a"), pl.col("b")]))
495
+ * shape: (4, 4)
496
+ * ┌───────┬───────┬─────┬───────┐
497
+ * │ a ┆ b ┆ c ┆ all │
498
+ * │ --- ┆ --- ┆ --- ┆ --- │
499
+ * │ bool ┆ bool ┆ str ┆ bool │
500
+ * ╞═══════╪═══════╪═════╪═══════╡
501
+ * │ false ┆ false ┆ w ┆ false │
502
+ * │ false ┆ true ┆ x ┆ false │
503
+ * │ true ┆ null ┆ y ┆ null │
504
+ * │ true ┆ true ┆ z ┆ true │
505
+ * └───────┴───────┴─────┴───────┘
506
+ * ```
507
+ */
508
+ export declare function allHorizontal(exprs: ExprOrString | ExprOrString[]): Expr;
509
+ /**
510
+ * Compute the bitwise OR horizontally across columns.
511
+ * @param exprs
512
+ * Column(s) to use in the aggregation. Accepts expression input. Strings are
513
+ * parsed as column names, other non-expression inputs are parsed as literals.
514
+ * @example
515
+ * ```
516
+ * >>> const df = pl.DataFrame(
517
+ * ... {
518
+ * ... "a": [false, false, true, null],
519
+ * ... "b": [false, true, null, null],
520
+ * ... "c": ["w", "x", "y", "z"],
521
+ * ... }
522
+ * ... )
523
+ * >>> df.withColumns(pl.anyHorizontal([pl.col("a"), pl.col("b")]))
524
+ * shape: (4, 4)
525
+ * ┌───────┬───────┬─────┬───────┐
526
+ * │ a ┆ b ┆ c ┆ any │
527
+ * │ --- ┆ --- ┆ --- ┆ --- │
528
+ * │ bool ┆ bool ┆ str ┆ bool │
529
+ * ╞═══════╪═══════╪═════╪═══════╡
530
+ * │ false ┆ false ┆ w ┆ false │
531
+ * │ false ┆ true ┆ x ┆ true │
532
+ * │ true ┆ null ┆ y ┆ true │
533
+ * │ null ┆ null ┆ z ┆ null │
534
+ * └───────┴───────┴─────┴───────┘
535
+ * ```
536
+ */
537
+ export declare function anyHorizontal(exprs: ExprOrString | ExprOrString[]): Expr;
538
+ /**
539
+ * Get the maximum value horizontally across columns.
540
+ * @param exprs
541
+ * Column(s) to use in the aggregation. Accepts expression input. Strings are
542
+ * parsed as column names, other non-expression inputs are parsed as literals.
543
+ * @example
544
+ * ```
545
+ * >>> const df = pl.DataFrame(
546
+ * ... {
547
+ * ... "a": [1, 8, 3],
548
+ * ... "b": [4, 5, null],
549
+ * ... "c": ["x", "y", "z"],
550
+ * ... }
551
+ * ... )
552
+ * >>> df.withColumns(pl.maxHorizontal(pl.col("a"), pl.col("b")))
553
+ * shape: (3, 4)
554
+ * ┌─────┬──────┬─────┬─────┐
555
+ * │ a ┆ b ┆ c ┆ max │
556
+ * │ --- ┆ --- ┆ --- ┆ --- │
557
+ * │ i64 ┆ i64 ┆ str ┆ i64 │
558
+ * ╞═════╪══════╪═════╪═════╡
559
+ * │ 1 ┆ 4 ┆ x ┆ 4 │
560
+ * │ 8 ┆ 5 ┆ y ┆ 8 │
561
+ * │ 3 ┆ null ┆ z ┆ 3 │
562
+ * └─────┴──────┴─────┴─────┘
563
+ * ```
564
+ */
565
+ export declare function maxHorizontal(exprs: ExprOrString | ExprOrString[]): Expr;
566
+ /**
567
+ * Get the minimum value horizontally across columns.
568
+ * @param exprs Column(s) to use in the aggregation. Accepts expression input. Strings are
569
+ * parsed as column names, other non-expression inputs are parsed as literals.
570
+ * @example
571
+ * ```
572
+ * >>> const df = pl.DataFrame(
573
+ * ... {
574
+ * ... "a": [1, 8, 3],
575
+ * ... "b": [4, 5, null],
576
+ * ... "c": ["x", "y", "z"],
577
+ * ... }
578
+ * ... )
579
+ * >>> df.withColumns(pl.minHorizontal(pl.col("a"), pl.col("b")))
580
+ * shape: (3, 4)
581
+ * ┌─────┬──────┬─────┬─────┐
582
+ * │ a ┆ b ┆ c ┆ min │
583
+ * │ --- ┆ --- ┆ --- ┆ --- │
584
+ * │ i64 ┆ i64 ┆ str ┆ i64 │
585
+ * ╞═════╪══════╪═════╪═════╡
586
+ * │ 1 ┆ 4 ┆ x ┆ 1 │
587
+ * │ 8 ┆ 5 ┆ y ┆ 5 │
588
+ * │ 3 ┆ null ┆ z ┆ 3 │
589
+ * └─────┴──────┴─────┴─────┘
590
+ * ```
591
+ */
592
+ export declare function minHorizontal(exprs: ExprOrString | ExprOrString[]): Expr;
593
+ /**
594
+ * Sum all values horizontally across columns.
595
+ * @param exprs
596
+ * Column(s) to use in the aggregation. Accepts expression input. Strings are
597
+ * parsed as column names, other non-expression inputs are parsed as literals.
598
+ * @example
599
+ * ```
600
+ * >>> const df = pl.DataFrame(
601
+ * ... {
602
+ * ... "a": [1, 8, 3],
603
+ * ... "b": [4, 5, null],
604
+ * ... "c": ["x", "y", "z"],
605
+ * ... }
606
+ * ... )
607
+ * >>> df.withColumns(pl.sumHorizontal(pl.col("a"), ol.col("b")))
608
+ * shape: (3, 4)
609
+ * ┌─────┬──────┬─────┬──────┐
610
+ * │ a ┆ b ┆ c ┆ sum │
611
+ * │ --- ┆ --- ┆ --- ┆ --- │
612
+ * │ i64 ┆ i64 ┆ str ┆ i64 │
613
+ * ╞═════╪══════╪═════╪══════╡
614
+ * │ 1 ┆ 4 ┆ x ┆ 5 │
615
+ * │ 8 ┆ 5 ┆ y ┆ 13 │
616
+ * │ 3 ┆ null ┆ z ┆ null │
617
+ * └─────┴──────┴─────┴──────┘
618
+ * ```
619
+ */
620
+ export declare function sumHorizontal(exprs: ExprOrString | ExprOrString[]): Expr;