@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,115 @@
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ exports.ExprListFunctions = void 0;
7
+ const polars_internal_1 = __importDefault(require("../../internals/polars_internal"));
8
+ const series_1 = require("../../series");
9
+ const expr_1 = require("../expr");
10
+ const functions_1 = require("../functions");
11
+ const ExprListFunctions = (_expr) => {
12
+ const wrap = (method, ...args) => {
13
+ return (0, expr_1._Expr)(_expr[method](...args));
14
+ };
15
+ return {
16
+ argMax() {
17
+ return wrap("listArgMax");
18
+ },
19
+ argMin() {
20
+ return wrap("listArgMin");
21
+ },
22
+ concat(other) {
23
+ if (Array.isArray(other) &&
24
+ !(expr_1.Expr.isExpr(other[0]) ||
25
+ series_1.Series.isSeries(other[0]) ||
26
+ typeof other[0] === "string")) {
27
+ return this.concat(polars_internal_1.default.Series([other]));
28
+ }
29
+ let otherList;
30
+ if (!Array.isArray(other)) {
31
+ otherList = [other];
32
+ }
33
+ else {
34
+ otherList = [...other];
35
+ }
36
+ otherList = [(0, expr_1._Expr)(_expr), ...otherList];
37
+ return (0, functions_1.concatList)(otherList);
38
+ },
39
+ contains(item, nullsEqual) {
40
+ return wrap("listContains", (0, expr_1.exprToLitOrExpr)(item)._expr, nullsEqual ?? true);
41
+ },
42
+ diff(n = 1, nullBehavior = "ignore") {
43
+ return wrap("listDiff", n, nullBehavior);
44
+ },
45
+ get(index, nullOnOob) {
46
+ if (expr_1.Expr.isExpr(index)) {
47
+ return wrap("listGet", index._expr, nullOnOob ?? true);
48
+ }
49
+ return wrap("listGet", polars_internal_1.default.lit(index), nullOnOob ?? true);
50
+ },
51
+ head(n = 5) {
52
+ return this.slice(0, n);
53
+ },
54
+ tail(n = 5) {
55
+ return this.slice(-n, n);
56
+ },
57
+ eval(expr) {
58
+ if (expr_1.Expr.isExpr(expr)) {
59
+ return wrap("listEval", expr._expr);
60
+ }
61
+ return wrap("listEval", expr);
62
+ },
63
+ first() {
64
+ return this.get(0);
65
+ },
66
+ join(options) {
67
+ if (typeof options === "string") {
68
+ options = { separator: options };
69
+ }
70
+ options = options ?? {};
71
+ let separator = options?.separator ?? ",";
72
+ const ignoreNulls = options?.ignoreNulls ?? false;
73
+ if (!expr_1.Expr.isExpr(separator)) {
74
+ separator = polars_internal_1.default.lit(separator);
75
+ }
76
+ return wrap("listJoin", separator, ignoreNulls);
77
+ },
78
+ last() {
79
+ return this.get(-1);
80
+ },
81
+ lengths() {
82
+ return wrap("listLengths");
83
+ },
84
+ max() {
85
+ return wrap("listMax");
86
+ },
87
+ mean() {
88
+ return wrap("listMean");
89
+ },
90
+ min() {
91
+ return wrap("listMin");
92
+ },
93
+ reverse() {
94
+ return wrap("listReverse");
95
+ },
96
+ shift(n) {
97
+ return wrap("listShift", (0, expr_1.exprToLitOrExpr)(n)._expr);
98
+ },
99
+ slice(offset, length) {
100
+ return wrap("listSlice", (0, expr_1.exprToLitOrExpr)(offset)._expr, (0, expr_1.exprToLitOrExpr)(length)._expr);
101
+ },
102
+ sort(descending = false) {
103
+ return typeof descending === "boolean"
104
+ ? wrap("listSort", descending)
105
+ : wrap("listSort", descending.descending);
106
+ },
107
+ sum() {
108
+ return wrap("listSum");
109
+ },
110
+ unique() {
111
+ return wrap("listUnique");
112
+ },
113
+ };
114
+ };
115
+ exports.ExprListFunctions = ExprListFunctions;
@@ -0,0 +1,534 @@
1
+ import { DataType } from "../../datatypes";
2
+ import type { StringFunctions } from "../../shared_traits";
3
+ import { Expr } from "../expr";
4
+ /**
5
+ * String functions for Lazy dataframes
6
+ */
7
+ export interface ExprString extends StringFunctions<Expr> {
8
+ /**
9
+ * Vertically concat the values in the Expression to a single string value.
10
+ * @example
11
+ * ```
12
+ * >>> const df = pl.DataFrame({"foo": [1, null, 2]});
13
+ * >>> df.select(pl.col("foo").str.concat("-"));
14
+ * shape: (1, 1)
15
+ * ┌──────────┐
16
+ * │ foo │
17
+ * │ --- │
18
+ * │ str │
19
+ * ╞══════════╡
20
+ * │ 1-null-2 │
21
+ * └──────────┘
22
+ * ```
23
+ */
24
+ concat(delimiter: string, ignoreNulls?: boolean): Expr;
25
+ /**
26
+ * Check if strings in Expression contain a substring that matches a pattern.
27
+ * @param pat A valid regular expression pattern, compatible with the `regex crate
28
+ * @param literal Treat `pattern` as a literal string, not as a regular expression.
29
+ * @param strict Raise an error if the underlying pattern is not a valid regex, otherwise mask out with a null value.
30
+ * @returns Boolean mask
31
+ * @example
32
+ * ```
33
+ * const df = pl.DataFrame({"txt": ["Crab", "cat and dog", "rab$bit", null]});
34
+ * df.select(
35
+ * ... pl.col("txt"),
36
+ * ... pl.col("txt").str.contains("cat|bit").alias("regex"),
37
+ * ... pl.col("txt").str.contains("rab$", true).alias("literal"),
38
+ * ... );
39
+ * shape: (4, 3)
40
+ * ┌─────────────┬───────┬─────────┐
41
+ * │ txt ┆ regex ┆ literal │
42
+ * │ --- ┆ --- ┆ --- │
43
+ * │ str ┆ bool ┆ bool │
44
+ * ╞═════════════╪═══════╪═════════╡
45
+ * │ Crab ┆ false ┆ false │
46
+ * │ cat and dog ┆ true ┆ false │
47
+ * │ rab$bit ┆ true ┆ true │
48
+ * │ null ┆ null ┆ null │
49
+ * └─────────────┴───────┴─────────┘
50
+ * ```
51
+ */
52
+ contains(pat: string | RegExp | Expr, literal?: boolean, strict?: boolean): Expr;
53
+ /**
54
+ * Decodes a value in Expression using the provided encoding
55
+ * @param encoding - hex | base64
56
+ * @param strict - how to handle invalid inputs
57
+ * - true: method will throw error if unable to decode a value
58
+ * - false: unhandled values will be replaced with `null`
59
+ * @example
60
+ * ```
61
+ * >>> const df = pl.DataFrame({"strings": ["666f6f", "626172", null]});
62
+ * >>> df.select(col("strings").str.decode("hex"))
63
+ * shape: (3, 1)
64
+ * ┌─────────┐
65
+ * │ strings │
66
+ * │ --- │
67
+ * │ str │
68
+ * ╞═════════╡
69
+ * │ foo │
70
+ * ├╌╌╌╌╌╌╌╌╌┤
71
+ * │ bar │
72
+ * ├╌╌╌╌╌╌╌╌╌┤
73
+ * │ null │
74
+ * └─────────┘
75
+ * ```
76
+ */
77
+ decode(encoding: "hex" | "base64", strict?: boolean): Expr;
78
+ decode(options: {
79
+ encoding: "hex" | "base64";
80
+ strict?: boolean;
81
+ }): Expr;
82
+ /**
83
+ * Encodes a value in Expression using the provided encoding
84
+ * @param encoding - hex | base64
85
+ * @example
86
+ * ```
87
+ * >>> const df = pl.DataFrame({"strings", ["foo", "bar", null]});
88
+ * >>> df.select(col("strings").str.encode("hex"))
89
+ * shape: (3, 1)
90
+ * ┌─────────┐
91
+ * │ strings │
92
+ * │ --- │
93
+ * │ str │
94
+ * ╞═════════╡
95
+ * │ 666f6f │
96
+ * ├╌╌╌╌╌╌╌╌╌┤
97
+ * │ 626172 │
98
+ * ├╌╌╌╌╌╌╌╌╌┤
99
+ * │ null │
100
+ * └─────────┘
101
+ * ```
102
+ */
103
+ encode(encoding: "hex" | "base64"): Expr;
104
+ /** Check if string values in Expression ends with a substring.
105
+ * @param suffix - Suffix substring or expression
106
+ * @example
107
+ * ```
108
+ * >>> const df = pl.DataFrame({"fruits": ["apple", "mango", None]});
109
+ * >>> df.withColumns( pl.col("fruits").str.endsWith("go").alias("has_suffix") );
110
+ * shape: (3, 2)
111
+ * ┌────────┬────────────┐
112
+ * │ fruits ┆ has_suffix │
113
+ * │ --- ┆ --- │
114
+ * │ str ┆ bool │
115
+ * ╞════════╪════════════╡
116
+ * │ apple ┆ false │
117
+ * │ mango ┆ true │
118
+ * │ null ┆ null │
119
+ * └────────┴────────────┘
120
+ *
121
+ * >>> df = pl.DataFrame(
122
+ * ... {"fruits": ["apple", "mango", "banana"], "suffix": ["le", "go", "nu"]}
123
+ * ... )
124
+ * >>> df.withColumns(
125
+ * ... pl.col("fruits").str.endsWith(pl.col("suffix")).alias("has_suffix"),
126
+ * ... )
127
+ * shape: (3, 3)
128
+ * ┌────────┬────────┬────────────┐
129
+ * │ fruits ┆ suffix ┆ has_suffix │
130
+ * │ --- ┆ --- ┆ --- │
131
+ * │ str ┆ str ┆ bool │
132
+ * ╞════════╪════════╪════════════╡
133
+ * │ apple ┆ le ┆ true │
134
+ * │ mango ┆ go ┆ true │
135
+ * │ banana ┆ nu ┆ false │
136
+ * └────────┴────────┴────────────┘
137
+ *
138
+ * Using `ends_with` as a filter condition:
139
+ *
140
+ * >>> df.filter(pl.col("fruits").str.endsWith("go"))
141
+ * shape: (1, 2)
142
+ * ┌────────┬────────┐
143
+ * │ fruits ┆ suffix │
144
+ * │ --- ┆ --- │
145
+ * │ str ┆ str │
146
+ * ╞════════╪════════╡
147
+ * │ mango ┆ go │
148
+ * └────────┴────────┘
149
+ * ```
150
+ */
151
+ endsWith(suffix: string | Expr): Expr;
152
+ /**
153
+ * Extract the target capture group from provided patterns.
154
+ * @param pattern A valid regex pattern
155
+ * @param groupIndex Index of the targeted capture group.
156
+ * Group 0 mean the whole pattern, first group begin at index 1
157
+ * Default to the first capture group
158
+ * @returns Utf8 array. Contain null if original value is null or regex capture nothing.
159
+ * @example
160
+ * ```
161
+ * > const df = pl.DataFrame({
162
+ * ... 'a': [
163
+ * ... 'http://vote.com/ballon_dor?candidate=messi&ref=polars',
164
+ * ... 'http://vote.com/ballon_dor?candidat=jorginho&ref=polars',
165
+ * ... 'http://vote.com/ballon_dor?candidate=ronaldo&ref=polars'
166
+ * ... ]});
167
+ * > df.select(pl.col('a').str.extract(/candidate=(\w+)/, 1))
168
+ * shape: (3, 1)
169
+ * ┌─────────┐
170
+ * │ a │
171
+ * │ --- │
172
+ * │ str │
173
+ * ╞═════════╡
174
+ * │ messi │
175
+ * ├╌╌╌╌╌╌╌╌╌┤
176
+ * │ null │
177
+ * ├╌╌╌╌╌╌╌╌╌┤
178
+ * │ ronaldo │
179
+ * └─────────┘
180
+ * ```
181
+ */
182
+ extract(pattern: string | RegExp | Expr, groupIndex: number): Expr;
183
+ /**
184
+ * Parse string values in Expression as JSON.
185
+ * Throw errors if encounter invalid JSON strings.
186
+ * @param dtype - Types to cast the extracted value to. We need to explicitly give `dtype` otherwise Polars is not able to determine the output type.
187
+ * @returns DF with struct
188
+ * @example
189
+ * ```
190
+ * >>> const df = pl.DataFrame( {json: ['{"a":1, "b": true}', null, '{"a":2, "b": false}']} )
191
+ * const dtype = pl.Struct([ new pl.Field("a", pl.Int64), new pl.Field("b", pl.Bool) ]);
192
+ * >>> df.select(pl.col("json").str.jsonDecode(dtype));
193
+ * shape: (3, 1)
194
+ * ┌─────────────┐
195
+ * │ json │
196
+ * │ --- │
197
+ * │ struct[2] │
198
+ * ╞═════════════╡
199
+ * │ {1,true} │
200
+ * │ {null,null} │
201
+ * │ {2,false} │
202
+ * └─────────────┘
203
+ * See Also
204
+ * ----------
205
+ * jsonPathMatch : Extract the first match of json string with provided JSONPath expression.
206
+ */
207
+ jsonDecode(dtype: DataType): Expr;
208
+ /**
209
+ * Extract the first match of json string in Expression with provided JSONPath expression.
210
+ * Throw errors if encounter invalid json strings.
211
+ * All return value will be casted to Utf8 regardless of the original value.
212
+ * @see https://goessner.net/articles/JsonPath/
213
+ * @param pat - A valid JSON path query string
214
+ * @returns Utf8 array. Contain null if original value is null or the `jsonPath` return nothing.
215
+ * @example
216
+ * ```
217
+ * >>> df = pl.DataFrame({
218
+ * ... 'json_val': [
219
+ * ... '{"a":"1"}',
220
+ * ... null,
221
+ * ... '{"a":2}',
222
+ * ... '{"a":2.1}',
223
+ * ... '{"a":true}'
224
+ * ... ]
225
+ * ... })
226
+ * >>> df.select(pl.col('json_val').str.jsonPathMatch('$.a')
227
+ * shape: (5, 1)
228
+ *┌──────────┐
229
+ *│ json_val │
230
+ *│ --- │
231
+ *│ str │
232
+ *╞══════════╡
233
+ *│ 1 │
234
+ *│ null │
235
+ *│ 2 │
236
+ *│ 2.1 │
237
+ *│ true │
238
+ *└──────────┘
239
+ * ```
240
+ */
241
+ jsonPathMatch(pat: string): Expr;
242
+ /** Get number of chars of the string values in Expression.
243
+ * ```
244
+ * df = pl.DataFrame({"a": ["Café", "345", "東京", null]})
245
+ * df.withColumns(
246
+ * pl.col("a").str.lengths().alias("n_chars"),
247
+ * )
248
+ * shape: (4, 3)
249
+ * ┌──────┬─────────┬─────────┐
250
+ * │ a ┆ n_chars ┆ n_bytes │
251
+ * │ --- ┆ --- ┆ --- │
252
+ * │ str ┆ u32 ┆ u32 │
253
+ * ╞══════╪═════════╪═════════╡
254
+ * │ Café ┆ 4 ┆ 5 │
255
+ * │ 345 ┆ 3 ┆ 3 │
256
+ * │ 東京 ┆ 2 ┆ 6 │
257
+ * │ null ┆ null ┆ null │
258
+ * └──────┴─────────┴─────────┘
259
+ * ```
260
+ */
261
+ lengths(): Expr;
262
+ /** Remove leading whitespace of the string values in Expression. */
263
+ lstrip(): Expr;
264
+ /** Replace first match with a string value in Expression.
265
+ * @param pattern - A valid regex pattern, string or expression
266
+ * @param value Substring or expression to replace.
267
+ * @param literal Treat pattern as a literal string.
268
+ * Note: pattern as expression is not yet supported by polars
269
+ * @example
270
+ * ```
271
+ * df = pl.DataFrame({"cost": ["#12.34", "#56.78"], "text": ["123abc", "abc456"]})
272
+ * df = df.withColumns(
273
+ * pl.col("cost").str.replace(/#(\d+)/, "$$$1"),
274
+ * pl.col("text").str.replace("ab", "-")
275
+ * pl.col("text").str.replace("abc", pl.col("cost")).alias("expr")
276
+ * );
277
+ * shape: (2, 2)
278
+ * ┌────────┬───────┬───────────┐
279
+ * │ cost ┆ text │ expr │
280
+ * │ --- ┆ --- │ --- │
281
+ * │ str ┆ str │ str │
282
+ * ╞════════╪═══════╪═══════════╡
283
+ * │ $12.34 ┆ 123-c │ 123#12.34 │
284
+ * │ $56.78 ┆ -c456 │ #56.78456 │
285
+ * └────────┴───────┴───────────┘
286
+ * ```
287
+ */
288
+ replace(pattern: string | RegExp | Expr, value: string | Expr, literal?: boolean, n?: number): Expr;
289
+ /** Replace all regex matches with a string value in Expression.
290
+ * @param pattern - A valid regex pattern, string or expression
291
+ * @param value Substring or expression to replace.
292
+ * @param literal Treat pattern as a literal string.
293
+ * Note: pattern as expression is not yet supported by polars
294
+ * @example
295
+ * ```
296
+ * df = df = pl.DataFrame({"weather": ["Rainy", "Sunny", "Cloudy", "Snowy"], "text": ["abcabc", "123a123", null, null]})
297
+ * df = df.withColumns(
298
+ * pl.col("weather").str.replaceAll(/foggy|rainy/i, "Sunny"),
299
+ * pl.col("text").str.replaceAll("a", "-")
300
+ * )
301
+ * shape: (4, 2)
302
+ * ┌─────────┬─────────┐
303
+ * │ weather ┆ text │
304
+ * │ --- ┆ --- │
305
+ * │ str ┆ str │
306
+ * ╞═════════╪═════════╡
307
+ * │ Sunny ┆ -bc-bc │
308
+ * │ Sunny ┆ 123-123 │
309
+ * │ Cloudy ┆ null │
310
+ * │ Snowy ┆ null │
311
+ * └─────────┴─────────┘
312
+ * ```
313
+ */
314
+ replaceAll(pattern: string | RegExp | Expr, value: string | Expr, literal?: boolean): Expr;
315
+ /** Modify the string in Expression to their lowercase equivalent. */
316
+ toLowerCase(): Expr;
317
+ /** Modify the string in Expression to their uppercase equivalent. */
318
+ toUpperCase(): Expr;
319
+ /** Remove trailing whitespace. */
320
+ rstrip(): Expr;
321
+ /**
322
+ * Add a leading fillChar to a string in Expression until string length is reached.
323
+ * If string is longer or equal to given length no modifications will be done
324
+ * @param {number} length - of the final string
325
+ * @param {string} fillChar - that will fill the string.
326
+ * If a string longer than 1 character is provided only the first character will be used
327
+ * @example
328
+ * ```
329
+ * > df = pl.DataFrame({
330
+ * ... 'foo': [
331
+ * ... "a",
332
+ * ... "b",
333
+ * ... "LONG_WORD",
334
+ * ... "cow"
335
+ * ... ]})
336
+ * > df.select(pl.col('foo').str.padStart("_", 3)
337
+ * shape: (4, 1)
338
+ * ┌──────────┐
339
+ * │ a │
340
+ * │ -------- │
341
+ * │ str │
342
+ * ╞══════════╡
343
+ * │ __a │
344
+ * ├╌╌╌╌╌╌╌╌╌╌┤
345
+ * │ __b │
346
+ * ├╌╌╌╌╌╌╌╌╌╌┤
347
+ * │ LONG_WORD│
348
+ * ├╌╌╌╌╌╌╌╌╌╌┤
349
+ * │ cow │
350
+ * └──────────┘
351
+ * ```
352
+ */
353
+ padStart(length: number, fillChar: string): Expr;
354
+ /**
355
+ * Add leading "0" to a string until string length is reached.
356
+ * If string is longer or equal to given length no modifications will be done
357
+ * @param {number} length - of the final string
358
+ * @see {@link padStart}
359
+ * @example
360
+ * ```
361
+ * > df = pl.DataFrame({
362
+ * ... 'foo': [
363
+ * ... "a",
364
+ * ... "b",
365
+ * ... "LONG_WORD",
366
+ * ... "cow"
367
+ * ... ]})
368
+ * > df.select(pl.col('foo').str.justify(3)
369
+ * shape: (4, 1)
370
+ * ┌──────────┐
371
+ * │ a │
372
+ * │ -------- │
373
+ * │ str │
374
+ * ╞══════════╡
375
+ * │ 00a │
376
+ * ├╌╌╌╌╌╌╌╌╌╌┤
377
+ * │ 00b │
378
+ * ├╌╌╌╌╌╌╌╌╌╌┤
379
+ * │ LONG_WORD│
380
+ * ├╌╌╌╌╌╌╌╌╌╌┤
381
+ * │ cow │
382
+ * └──────────┘
383
+ * ```
384
+ */
385
+ zFill(length: number | Expr): Expr;
386
+ /**
387
+ * Add a trailing fillChar to a string until string length is reached.
388
+ * If string is longer or equal to given length no modifications will be done
389
+ * @param {number} length - of the final string
390
+ * @param {string} fillChar - that will fill the string.
391
+ * Note: If a string longer than 1 character is provided only the first character will be used
392
+ * @example
393
+ * ```
394
+ * > df = pl.DataFrame({
395
+ * ... 'foo': [
396
+ * ... "a",
397
+ * ... "b",
398
+ * ... "LONG_WORD",
399
+ * ... "cow"
400
+ * ... ]})
401
+ * > df.select(pl.col('foo').str.padEnd("_", 3)
402
+ * shape: (4, 1)
403
+ * ┌──────────┐
404
+ * │ a │
405
+ * │ -------- │
406
+ * │ str │
407
+ * ╞══════════╡
408
+ * │ a__ │
409
+ * ├╌╌╌╌╌╌╌╌╌╌┤
410
+ * │ b__ │
411
+ * ├╌╌╌╌╌╌╌╌╌╌┤
412
+ * │ LONG_WORD│
413
+ * ├╌╌╌╌╌╌╌╌╌╌┤
414
+ * │ cow │
415
+ * └──────────┘
416
+ * ```
417
+ */
418
+ padEnd(length: number, fillChar: string): Expr;
419
+ /**
420
+ * Create subslices of the string values of a Utf8 Series.
421
+ * @param start - Start of the slice (negative indexing may be used).
422
+ * @param length - Optional length of the slice.
423
+ */
424
+ slice(start: number | Expr, length?: number | Expr): Expr;
425
+ /**
426
+ * Split a string into substrings using the specified separator and return them as a Series.
427
+ * @param by — A string that identifies character or characters to use in separating the string.
428
+ * @param options.inclusive Include the split character/string in the results
429
+ */
430
+ split(by: string, options?: {
431
+ inclusive?: boolean;
432
+ } | boolean): Expr;
433
+ /** Check if string values start with a substring.
434
+ * @param prefix - Prefix substring or expression
435
+ * @example
436
+ * ```
437
+ * >>> df = pl.DataFrame({"fruits": ["apple", "mango", None]})
438
+ * >>> df.withColumns(
439
+ * ... pl.col("fruits").str.startsWith("app").alias("has_prefix"),
440
+ * ... )
441
+ * shape: (3, 2)
442
+ * ┌────────┬────────────┐
443
+ * │ fruits ┆ has_prefix │
444
+ * │ --- ┆ --- │
445
+ * │ str ┆ bool │
446
+ * ╞════════╪════════════╡
447
+ * │ apple ┆ true │
448
+ * │ mango ┆ false │
449
+ * │ null ┆ null │
450
+ * └────────┴────────────┘
451
+ *
452
+ * >>> df = pl.DataFrame(
453
+ * ... {"fruits": ["apple", "mango", "banana"], "prefix": ["app", "na", "ba"]}
454
+ * ... )
455
+ * >>> df.withColumns(
456
+ * ... pl.col("fruits").str.startsWith(pl.col("prefix")).alias("has_prefix"),
457
+ * ... )
458
+ * shape: (3, 3)
459
+ * ┌────────┬────────┬────────────┐
460
+ * │ fruits ┆ prefix ┆ has_prefix │
461
+ * │ --- ┆ --- ┆ --- │
462
+ * │ str ┆ str ┆ bool │
463
+ * ╞════════╪════════╪════════════╡
464
+ * │ apple ┆ app ┆ true │
465
+ * │ mango ┆ na ┆ false │
466
+ * │ banana ┆ ba ┆ true │
467
+ * └────────┴────────┴────────────┘
468
+ *
469
+ * Using `starts_with` as a filter condition:
470
+ *
471
+ * >>> df.filter(pl.col("fruits").str.startsWith("app"))
472
+ * shape: (1, 2)
473
+ * ┌────────┬────────┐
474
+ * │ fruits ┆ prefix │
475
+ * │ --- ┆ --- │
476
+ * │ str ┆ str │
477
+ * ╞════════╪════════╡
478
+ * │ apple ┆ app │
479
+ * └────────┴────────┘
480
+ * ```
481
+ */
482
+ startsWith(prefix: string | Expr): Expr;
483
+ /** Remove leading and trailing whitespace. */
484
+ strip(): Expr;
485
+ /**
486
+ * Parse a Series of dtype Utf8 to a Date/Datetime Series.
487
+ * @param datatype Date or Datetime.
488
+ * @param fmt formatting syntax. [Read more](https://docs.rs/chrono/0.4.19/chrono/format/strftime/index.html)
489
+ */
490
+ strptime(datatype: DataType.Date, fmt?: string): Expr;
491
+ strptime(datatype: DataType.Datetime, fmt?: string): Expr;
492
+ strptime(datatype: typeof DataType.Datetime, fmt?: string): Expr;
493
+ /** Remove leading and trailing whitespace.
494
+ * @param prefix - Prefix substring or expression (null means whitespace)
495
+ * @example
496
+ * ```
497
+ * >>> df = pl.DataFrame({
498
+ * os: [
499
+ * "#Kali-Linux###",
500
+ * "$$$Debian-Linux$",
501
+ * null,
502
+ * "Ubuntu-Linux ",
503
+ * " Mac-Sierra",
504
+ * ],
505
+ * chars: ["#", "$", " ", " ", null],
506
+ * })
507
+ * >>> df.select(col("os").str.stripChars(col("chars")).as("os"))
508
+ * shape: (5, 1)
509
+ * ┌──────────────┐
510
+ * │ os │
511
+ * │ --- │
512
+ * │ str │
513
+ * ╞══════════════╡
514
+ * │ Kali-Linux │
515
+ * │ Debian-Linux │
516
+ * │ null │
517
+ * │ Ubuntu-Linux │
518
+ * │ Mac-Sierra │
519
+ * └──────────────┘
520
+ * ```
521
+ */
522
+ stripChars(prefix: string | Expr): Expr;
523
+ /** Remove trailing characters.
524
+ * @param prefix - Prefix substring or expression (null means whitespace)
525
+ * @see stripChars
526
+ */
527
+ stripCharsEnd(prefix: string | Expr): Expr;
528
+ /** Remove leading characters.
529
+ * @param prefix - Prefix substring or expression (null means whitespace)
530
+ * @see stripChars
531
+ */
532
+ stripCharsStart(prefix: string | Expr): Expr;
533
+ }
534
+ export declare const ExprStringFunctions: (_expr: any) => ExprString;