df-script 1.8.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 (64) hide show
  1. package/README.md +153 -203
  2. package/dist/api.d.ts +41 -36
  3. package/dist/columnExpressions/ColumnExpr.d.ts +5 -8
  4. package/dist/columnExpressions/ExprBase.d.ts +7 -0
  5. package/dist/columnExpressions/constants.d.ts +1 -0
  6. package/dist/columnExpressions/functions/all.d.ts +13 -13
  7. package/dist/columnExpressions/functions/coalesce.d.ts +2 -2
  8. package/dist/columnExpressions/functions/duration.d.ts +16 -21
  9. package/dist/columnExpressions/functions/element.d.ts +10 -10
  10. package/dist/columnExpressions/functions/exclude.d.ts +14 -14
  11. package/dist/columnExpressions/functions/implode.d.ts +7 -7
  12. package/dist/columnExpressions/functions/lit.d.ts +9 -9
  13. package/dist/columnExpressions/functions/seqRange.d.ts +69 -0
  14. package/dist/columnExpressions/functions/struct.d.ts +6 -6
  15. package/dist/columnExpressions/functions/when.d.ts +31 -32
  16. package/dist/columnExpressions/index.d.ts +4 -7
  17. package/dist/columnExpressions/mixins/AggregationExpr.d.ts +672 -141
  18. package/dist/columnExpressions/mixins/ArithmeticExpr.d.ts +701 -327
  19. package/dist/columnExpressions/mixins/ArrayExpr.d.ts +543 -231
  20. package/dist/columnExpressions/mixins/ComparisonExpr.d.ts +398 -201
  21. package/dist/columnExpressions/mixins/LogicalExpr.d.ts +59 -29
  22. package/dist/columnExpressions/mixins/ManipulationExpr.d.ts +23 -9
  23. package/dist/columnExpressions/mixins/StandardExpr.d.ts +3234 -0
  24. package/dist/columnExpressions/mixins/StringExpr.d.ts +1299 -396
  25. package/dist/columnExpressions/mixins/StructExpr.d.ts +72 -30
  26. package/dist/columnExpressions/mixins/TemporalExpr.d.ts +518 -212
  27. package/dist/columnExpressions/mixins/WindowExpr.d.ts +270 -102
  28. package/dist/columnExpressions/typeInference.d.ts +13 -0
  29. package/dist/columnExpressions/types.d.ts +6 -1
  30. package/dist/columnExpressions/utils.d.ts +16 -0
  31. package/dist/constants.d.ts +38 -0
  32. package/dist/dataframe/dataframe.d.ts +755 -608
  33. package/dist/dataframe/grouped/grouped.d.ts +24 -6
  34. package/dist/dataframe/grouped.d.ts +70 -0
  35. package/dist/dataframe/index.d.ts +1 -1
  36. package/dist/dataframe/lazy.d.ts +37 -0
  37. package/dist/dataframe/types.d.ts +46 -22
  38. package/dist/dataframe/utils.d.ts +10 -4
  39. package/dist/datatypes/index.d.ts +11 -4
  40. package/dist/expressions.js +1 -0
  41. package/dist/expressions.mjs +1 -0
  42. package/dist/functions/concat.d.ts +68 -16
  43. package/dist/functions/index.d.ts +2 -2
  44. package/dist/functions/readCsv.d.ts +35 -0
  45. package/dist/functions/readJson.d.ts +33 -0
  46. package/dist/index.js +5 -6
  47. package/dist/index.mjs +5 -6
  48. package/dist/types.d.ts +148 -7
  49. package/dist/utils/array.d.ts +54 -18
  50. package/dist/utils/binary.d.ts +6 -2
  51. package/dist/utils/csv.d.ts +4 -1
  52. package/dist/utils/date.d.ts +3 -19
  53. package/dist/utils/duration.d.ts +7 -5
  54. package/dist/utils/json.d.ts +56 -2
  55. package/dist/utils/number.d.ts +5 -2
  56. package/dist/utils/object.d.ts +7 -12
  57. package/dist/utils/string.d.ts +83 -2
  58. package/dist/utils/table.d.ts +76 -0
  59. package/dist/utils.js +4 -0
  60. package/dist/utils.mjs +4 -0
  61. package/package.json +29 -8
  62. package/dist/assets/index-DBhGK6Tp.css +0 -1
  63. package/dist/assets/index-DEJEV_tU.js +0 -195
  64. package/dist/index.html +0 -17
@@ -1,6 +1,6 @@
1
- import type { IExpr, StrptimeOptions } from "../../types";
1
+ import type { IExpr, StrptimeOptions, StringDecodeOptions, StringEncodeOptions, EscapeRegexOptions, ExtractManyOptions, ExtractRegexEngineOptions, FindOptions, FindManyOptions, SplitOptions, ReplaceOptions, ReplaceManyOptions } from "../../types";
2
2
  import { ExprBase } from "../ExprBase";
3
- import { StripCharsOptions } from "../../utils";
3
+ import { StripCharsOptions, JoinArrayOptions, SafeJsonParseOptions } from "../../utils";
4
4
  /**
5
5
  * @namespace $df.col.str
6
6
  * @category ColumnExpression
@@ -11,19 +11,31 @@ export declare class StringExprNamespace {
11
11
  constructor(expr: any);
12
12
  _deriveString(fn: (v: string) => any): any;
13
13
  _patternGuard(pattern: any, fn: () => any): any;
14
+ _matchPattern(str: string, pattern: string | RegExp): boolean;
14
15
  /**
15
16
  * Concatenates string elements with another string value or expression.
16
17
  * @param other The string value or column expression to concatenate.
17
18
  * @returns ColumnExpression
18
19
  * @example
19
- * >>> const df = $df.data({ first: ["John"], last: ["Doe"] })
20
- * >>> df.with_columns($df.col("first").str.concat(" ").str.concat($df.col("last")).alias("full"))
21
- * shape: (1, 3)
22
- * ┌───────┬──────┬──────────┐
23
- * │ first last │ full │
24
- * ├───────┼──────┼──────────┤
25
- * │ John Doe │ John Doe │
26
- * └───────┴──────┴──────────┘
20
+ * >>> const df = $df.data({ s: ["apple", "banana", "cherry"] })
21
+ * >>> df
22
+ * shape: (3, 1)
23
+ * ┌──────────┐
24
+ * │ s
25
+ * ├──────────┤
26
+ * │ "apple"
27
+ * │ "banana" │
28
+ * │ "cherry" │
29
+ * └──────────┘
30
+ * >>> df.withColumns($df.col("s").str.concat("!").alias("exclaimed"))
31
+ * shape: (3, 2)
32
+ * ┌──────────┬───────────┐
33
+ * │ s │ exclaimed │
34
+ * ├──────────┼───────────┤
35
+ * │ "apple" │ apple! │
36
+ * │ "banana" │ banana! │
37
+ * │ "cherry" │ cherry! │
38
+ * └──────────┴───────────┘
27
39
  */
28
40
  concat(other: string | IExpr): any;
29
41
  /**
@@ -31,8 +43,17 @@ export declare class StringExprNamespace {
31
43
  * @param pattern The search substring or regular expression pattern.
32
44
  * @returns ColumnExpression
33
45
  * @example
34
- * >>> const df = $df.data({ email: ["user@example.com", "admin@test.org"] })
35
- * >>> df.with_columns($df.col("email").str.contains("@example.com").alias("is_example"))
46
+ * >>> const df = $df.data({ s: ["apple", "banana", "cherry"] })
47
+ * >>> df
48
+ * shape: (3, 1)
49
+ * ┌──────────┐
50
+ * │ s │
51
+ * ├──────────┤
52
+ * │ "apple" │
53
+ * │ "banana" │
54
+ * │ "cherry" │
55
+ * └──────────┘
56
+ * >>> df.withColumns($df.col("email").str.contains("@example.com").alias("is_example"))
36
57
  * shape: (2, 2)
37
58
  * ┌──────────────────┬────────────┐
38
59
  * │ email │ is_example │
@@ -42,150 +63,599 @@ export declare class StringExprNamespace {
42
63
  * └──────────────────┴────────────┘
43
64
  */
44
65
  contains(pattern: string | RegExp): any;
66
+ /**
67
+ * Checks if a string contains any of the search patterns.
68
+ * @param patterns Array of substring or regular expression search patterns.
69
+ * @returns ColumnExpression
70
+ * @example
71
+ * >>> const df = $df.data({ s: ["apple", "banana", "cherry"] })
72
+ * >>> df
73
+ * shape: (3, 1)
74
+ * ┌──────────┐
75
+ * │ s │
76
+ * ├──────────┤
77
+ * │ "apple" │
78
+ * │ "banana" │
79
+ * │ "cherry" │
80
+ * └──────────┘
81
+ * >>> df.withColumns($df.col("email").str.containsAny(["@example.com", "@test.org"]).alias("is_target"))
82
+ * shape: (2, 2)
83
+ * ┌──────────────────┬───────────┐
84
+ * │ email │ is_target │
85
+ * ├──────────────────┼───────────┤
86
+ * │ user@example.com │ true │
87
+ * │ admin@test.org │ true │
88
+ * └──────────────────┴───────────┘
89
+ */
90
+ containsAny(patterns: (string | RegExp)[]): any;
45
91
  /**
46
92
  * Counts occurrences of a substring or regular expression match in each string element.
47
93
  * @param pattern Search substring or regular expression.
48
94
  * @returns ColumnExpression
49
95
  * @example
50
- * >>> const df = $df.data({ code: ["banana", "apple"] })
51
- * >>> df.with_columns($df.col("code").str.count_matches("a").alias("a_count"))
52
- * shape: (2, 2)
53
- * ┌────────┬─────────┐
54
- * │ code a_count │
55
- * ├────────┼─────────┤
56
- * │ banana 3 │
57
- * │ apple │ 1
58
- * └────────┴─────────┘
96
+ * >>> const df = $df.data({ s: ["apple", "banana", "cherry"] })
97
+ * >>> df
98
+ * shape: (3, 1)
99
+ * ┌──────────┐
100
+ * │ s
101
+ * ├──────────┤
102
+ * │ "apple"
103
+ * │ "banana"
104
+ * │ "cherry" │
105
+ * └──────────┘
106
+ * >>> df.withColumns($df.col("s").str.countMatches("a").alias("a_count"))
107
+ * shape: (3, 2)
108
+ * ┌──────────┬─────────┐
109
+ * │ s │ a_count │
110
+ * ├──────────┼─────────┤
111
+ * │ "apple" │ 1 │
112
+ * │ "banana" │ 3 │
113
+ * │ "cherry" │ 0 │
114
+ * └──────────┴─────────┘
115
+ */
116
+ countMatches(pattern: string | RegExp | any, options?: {
117
+ literal?: boolean;
118
+ } | boolean): any;
119
+ /**
120
+ * Escapes special regular expression characters in string elements.
121
+ * @returns ColumnExpression
122
+ * @example
123
+ * >>> const df = $df.data({ s: ["apple", "banana", "cherry"] })
124
+ * >>> df
125
+ * shape: (3, 1)
126
+ * ┌──────────┐
127
+ * │ s │
128
+ * ├──────────┤
129
+ * │ "apple" │
130
+ * │ "banana" │
131
+ * │ "cherry" │
132
+ * └──────────┘
133
+ * >>> df.withColumns($df.col("s").str.escapeRegex().alias("escaped"))
134
+ * shape: (3, 2)
135
+ * ┌──────────┬─────────┐
136
+ * │ s │ escaped │
137
+ * ├──────────┼─────────┤
138
+ * │ "apple" │ apple │
139
+ * │ "banana" │ banana │
140
+ * │ "cherry" │ cherry │
141
+ * └──────────┴─────────┘
142
+ */
143
+ escapeRegex(options?: EscapeRegexOptions): any;
144
+ /**
145
+ * Decodes hex or base64 encoded string column values into string.
146
+ * @note [Runtime Fallback]: Automatically leverages native `Uint8Array.fromBase64` / `Uint8Array.fromHex`
147
+ * when available in the runtime, with seamless automatic fallback to standard decoding across older environments.
148
+ * @param options Object containing encoding ("hex" | "base64") and optional strict flag
149
+ * @returns ColumnExpression
150
+ * @example
151
+ * >>> const df = $df.data({ s: ["apple", "banana", "cherry"] })
152
+ * >>> df
153
+ * shape: (3, 1)
154
+ * ┌──────────┐
155
+ * │ s │
156
+ * ├──────────┤
157
+ * │ "apple" │
158
+ * │ "banana" │
159
+ * │ "cherry" │
160
+ * └──────────┘
161
+ * >>> df.withColumns($df.col("s").str.encode({ encoding: "hex" }).str.decode({ encoding: "hex" }).alias("decoded"))
162
+ * shape: (3, 2)
163
+ * ┌──────────┬─────────┐
164
+ * │ s │ decoded │
165
+ * ├──────────┼─────────┤
166
+ * │ "apple" │ apple │
167
+ * │ "banana" │ banana │
168
+ * │ "cherry" │ cherry │
169
+ * └──────────┴─────────┘
170
+ */
171
+ decode(options: StringDecodeOptions): any;
172
+ /**
173
+ * Encodes string column values into hex or base64.
174
+ * @note [Runtime Fallback]: Automatically leverages native `Uint8Array.prototype.toBase64` / `Uint8Array.prototype.toHex`
175
+ * when available, with automatic fallback across standard environments.
176
+ * @param options Object containing encoding ("hex" | "base64")
177
+ * @returns ColumnExpression
178
+ * @example
179
+ * >>> const df = $df.data({ s: ["apple", "banana", "cherry"] })
180
+ * >>> df
181
+ * shape: (3, 1)
182
+ * ┌──────────┐
183
+ * │ s │
184
+ * ├──────────┤
185
+ * │ "apple" │
186
+ * │ "banana" │
187
+ * │ "cherry" │
188
+ * └──────────┘
189
+ * >>> df.withColumns($df.col("s").str.encode({ encoding: "hex" }).alias("encoded"))
190
+ * shape: (3, 2)
191
+ * ┌──────────┬────────────────┐
192
+ * │ s │ encoded │
193
+ * ├──────────┼────────────────┤
194
+ * │ "apple" │ 6170706c65 │
195
+ * │ "banana" │ 62616e616e61 │
196
+ * │ "cherry" │ 636865727279 │
197
+ * └──────────┴────────────────┘
59
198
  */
60
- count_matches(pattern: string | RegExp): any;
199
+ encode(options: StringEncodeOptions): any;
61
200
  /**
62
201
  * Decodes Uniform Resource Identifier (URI) components.
63
202
  * @returns ColumnExpression
64
203
  * @example
65
- * >>> const df = $df.data({ url: ["hello%20world"] })
66
- * >>> df.with_columns($df.col("url").str.decode_uri_component().alias("decoded"))
67
- * shape: (1, 2)
68
- * ┌───────────────┬─────────────┐
69
- * │ url decoded │
70
- * ├───────────────┼─────────────┤
71
- * │ hello%20world hello world │
72
- * └───────────────┴─────────────┘
204
+ * >>> const df = $df.data({ s: ["apple", "banana", "cherry"] })
205
+ * >>> df
206
+ * shape: (3, 1)
207
+ * ┌──────────┐
208
+ * │ s
209
+ * ├──────────┤
210
+ * │ "apple"
211
+ * │ "banana" │
212
+ * │ "cherry" │
213
+ * └──────────┘
214
+ * >>> df.withColumns($df.col("s").str.encodeUriComponent().str.decodeUriComponent().alias("decoded"))
215
+ * shape: (2, 2)
216
+ * ┌─────────────┬─────────────┐
217
+ * │ s │ decoded │
218
+ * ├─────────────┼─────────────┤
219
+ * │ " hello " │ " hello " │
220
+ * │ " world " │ " world " │
221
+ * └─────────────┴─────────────┘
73
222
  */
74
- decode_uri_component(): any;
223
+ decodeUriComponent(): any;
75
224
  /**
76
225
  * Encodes Uniform Resource Identifier (URI) components.
77
226
  * @returns ColumnExpression
78
227
  * @example
79
- * >>> const df = $df.data({ term: ["hello world"] })
80
- * >>> df.with_columns($df.col("term").str.encode_uri_component().alias("encoded"))
81
- * shape: (1, 2)
82
- * ┌─────────────┬───────────────┐
83
- * │ term encoded │
84
- * ├─────────────┼───────────────┤
85
- * │ hello world hello%20world │
86
- * └─────────────┴───────────────┘
228
+ * >>> const df = $df.data({ s: ["apple", "banana", "cherry"] })
229
+ * >>> df
230
+ * shape: (3, 1)
231
+ * ┌──────────┐
232
+ * │ s
233
+ * ├──────────┤
234
+ * │ "apple"
235
+ * │ "banana" │
236
+ * │ "cherry" │
237
+ * └──────────┘
238
+ * >>> df.withColumns($df.col("s").str.encodeUriComponent().alias("encoded"))
239
+ * shape: (2, 2)
240
+ * ┌─────────────┬───────────────────┐
241
+ * │ s │ encoded │
242
+ * ├─────────────┼───────────────────┤
243
+ * │ " hello " │ "%20%20hello%20%20" │
244
+ * │ " world " │ "%20%20world%20%20" │
245
+ * └─────────────┴───────────────────┘
87
246
  */
88
- encode_uri_component(): any;
247
+ encodeUriComponent(): any;
89
248
  /**
90
249
  * Checks if string ends with a suffix.
91
250
  * @param suffix The suffix substring.
92
251
  * @returns ColumnExpression
93
252
  * @example
94
- * >>> const df = $df.data({ email: ["user@org.org", "admin@com.com"] })
95
- * >>> df.with_columns($df.col("email").str.ends_with(".org").alias("is_org"))
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("email").str.endsWith(".org").alias("is_org"))
96
264
  * shape: (2, 2)
97
- * ┌──────────────┬────────┐
98
- * │ email │ is_org │
99
- * ├──────────────┼────────┤
100
- * │ user@org.orgtrue
101
- * │ admin@com.comfalse
102
- * └──────────────┴────────┘
265
+ * ┌──────────────────┬────────┐
266
+ * │ email │ is_org │
267
+ * ├──────────────────┼────────┤
268
+ * │ user@example.comfalse
269
+ * │ admin@test.org true
270
+ * └──────────────────┴────────┘
103
271
  */
104
- ends_with(suffix: string): any;
272
+ endsWith(suffix: string): any;
105
273
  /**
106
274
  * Splits strings into lists of single characters.
107
275
  * @returns ColumnExpression
108
276
  * @example
109
- * >>> const df = $df.data({ word: ["cat"] })
110
- * >>> df.with_columns($df.col("word").str.explode().alias("chars"))
111
- * shape: (1, 2)
112
- * ┌──────┬─────────────────┐
113
- * │ word chars │
114
- * ├──────┼─────────────────┤
115
- * │ cat │ ["c", "a", "t"]
116
- * └──────┴─────────────────┘
277
+ * >>> const df = $df.data({ s: ["apple", "banana", "cherry"] })
278
+ * >>> df
279
+ * shape: (3, 1)
280
+ * ┌──────────┐
281
+ * │ s
282
+ * ├──────────┤
283
+ * │ "apple"
284
+ * │ "banana" │
285
+ * │ "cherry" │
286
+ * └──────────┘
287
+ * >>> df.withColumns($df.col("s").str.explode().alias("chars"))
288
+ * shape: (3, 2)
289
+ * ┌──────────┬─────────────────────────────────────┐
290
+ * │ s │ chars │
291
+ * ├──────────┼─────────────────────────────────────┤
292
+ * │ "apple" │ ["a", "p", "p", "l", "e"] │
293
+ * │ "banana" │ ["b", "a", "n", "a", "n", "a"] │
294
+ * │ "cherry" │ ["c", "h", "e", "r", "r", "y"] │
295
+ * └──────────┴─────────────────────────────────────┘
117
296
  */
118
297
  explode(): any;
119
298
  /**
120
- * Extracts captured group matching a regular expression pattern.
299
+ * Extracts a captured group from the first regex match.
121
300
  * @param pattern The regex pattern containing capture groups.
122
- * @param group Group index to extract (default 0 for whole match).
301
+ * @param options Options object. Use `groupIndex` to select the group (default 1).
123
302
  * @returns ColumnExpression
124
303
  * @example
125
- * >>> const df = $df.data({ info: ["id:123"] })
126
- * >>> df.with_columns($df.col("info").str.extract(/id:(\d+)/, 1).alias("id"))
127
- * shape: (1, 2)
128
- * ┌────────┬─────┐
129
- * │ info id │
130
- * ├────────┼─────┤
131
- * │ id:123 123 │
132
- * └────────┴─────┘
304
+ * >>> const df = $df.data({ s: ["apple", "banana", "cherry"] })
305
+ * >>> df
306
+ * shape: (3, 1)
307
+ * ┌──────────┐
308
+ * │ s
309
+ * ├──────────┤
310
+ * │ "apple"
311
+ * │ "banana" │
312
+ * │ "cherry" │
313
+ * └──────────┘
314
+ * >>> df.withColumns($df.col("email").str.extract(/@(\w+)/).alias("domain"))
315
+ * shape: (2, 2)
316
+ * ┌──────────────────┬─────────┐
317
+ * │ email │ domain │
318
+ * ├──────────────────┼─────────┤
319
+ * │ user@example.com │ example │
320
+ * │ admin@test.org │ test │
321
+ * └──────────────────┴─────────┘
133
322
  */
134
- extract(pattern: RegExp, group?: number): any;
323
+ extract(pattern: RegExp | string, options?: ExtractRegexEngineOptions): any;
135
324
  /**
136
- * Returns string length in UTF-16 code units. Alias for len_chars.
325
+ * Extracts all occurrences matching a regular expression pattern.
326
+ * @param pattern Search pattern (string or RegExp).
327
+ * @param options Options object. Use `groupIndex` to select the group (default 0).
137
328
  * @returns ColumnExpression
138
329
  * @example
139
- * >>> const df = $df.data({ str: ["hello"] })
140
- * >>> df.with_columns($df.col("str").str.len().alias("length"))
141
- * shape: (1, 2)
142
- * ┌───────┬────────┐
143
- * │ str length │
144
- * ├───────┼────────┤
145
- * │ hello 5 │
146
- * └───────┴────────┘
330
+ * >>> const df = $df.data({ s: ["apple", "banana", "cherry"] })
331
+ * >>> df
332
+ * shape: (3, 1)
333
+ * ┌──────────┐
334
+ * │ s
335
+ * ├──────────┤
336
+ * │ "apple"
337
+ * │ "banana" │
338
+ * │ "cherry" │
339
+ * └──────────┘
340
+ * >>> df.withColumns($df.col("s").str.extractAll(/[aeiou]/).alias("vowels"))
341
+ * shape: (3, 2)
342
+ * ┌──────────┬─────────────────┐
343
+ * │ s │ vowels │
344
+ * ├──────────┼─────────────────┤
345
+ * │ "apple" │ ["a", "e"] │
346
+ * │ "banana" │ ["a", "a", "a"] │
347
+ * │ "cherry" │ ["e"] │
348
+ * └──────────┴─────────────────┘
349
+ */
350
+ extractAll(pattern: string | RegExp, options?: ExtractRegexEngineOptions): any;
351
+ /**
352
+ * Extracts all captured groups from the first regex match into a structured object (struct).
353
+ * @param pattern Search pattern containing capture groups.
354
+ * @returns ColumnExpression
355
+ * @example
356
+ * >>> const df = $df.data({ s: ["apple", "banana", "cherry"] })
357
+ * >>> df
358
+ * shape: (3, 1)
359
+ * ┌──────────┐
360
+ * │ s │
361
+ * ├──────────┤
362
+ * │ "apple" │
363
+ * │ "banana" │
364
+ * │ "cherry" │
365
+ * └──────────┘
366
+ * >>> df.withColumns($df.col("email").str.extractGroups(/(?<user>\w+)@(?<domain>\w+)/).alias("parsed"))
367
+ * shape: (2, 2)
368
+ * ┌──────────────────┬────────────────────────────────────┐
369
+ * │ email │ parsed │
370
+ * ├──────────────────┼────────────────────────────────────┤
371
+ * │ user@example.com │ { user: "user", domain: "example" }│
372
+ * │ admin@test.org │ { user: "admin", domain: "test" } │
373
+ * └──────────────────┴────────────────────────────────────┘
374
+ */
375
+ extractGroups(pattern: string | RegExp, options?: ExtractManyOptions): any;
376
+ /**
377
+ * Extracts the first regex match for each pattern in a list of patterns.
378
+ * @param patterns Array of regular expression patterns or strings.
379
+ * @param options Named options object ({ asciiCaseInsensitive, overlapping }).
380
+ * @returns ColumnExpression
381
+ * @example
382
+ * >>> const df = $df.data({ s: ["apple", "banana", "cherry"] })
383
+ * >>> df
384
+ * shape: (3, 1)
385
+ * ┌──────────┐
386
+ * │ s │
387
+ * ├──────────┤
388
+ * │ "apple" │
389
+ * │ "banana" │
390
+ * │ "cherry" │
391
+ * └──────────┘
392
+ * >>> df.withColumns($df.col("s").str.extractMany([/app/, /ban/, /che/]).alias("extracted"))
393
+ * shape: (3, 2)
394
+ * ┌──────────┬─────────────┐
395
+ * │ s │ extracted │
396
+ * ├──────────┼─────────────┤
397
+ * │ "apple" │ ["app"] │
398
+ * │ "banana" │ ["ban"] │
399
+ * │ "cherry" │ ["che"] │
400
+ * └──────────┴─────────────┘
401
+ */
402
+ extractMany(patterns: (string | RegExp)[], options?: ExtractManyOptions): any;
403
+ /**
404
+ * Return the byte offset of the first substring matching a pattern.
405
+ * Returns null if pattern is not found.
406
+ * @param value Search string or regular expression.
407
+ * @param options Configuration options ({ literal, asciiCaseInsensitive }).
408
+ * @returns ColumnExpression
409
+ * @example
410
+ * >>> const df = $df.data({ s: ["apple", "banana", "cherry"] })
411
+ * >>> df
412
+ * shape: (3, 1)
413
+ * ┌──────────┐
414
+ * │ s │
415
+ * ├──────────┤
416
+ * │ "apple" │
417
+ * │ "banana" │
418
+ * │ "cherry" │
419
+ * └──────────┘
420
+ * >>> df.withColumns($df.col("s").str.find("a").alias("pos"))
421
+ * shape: (3, 2)
422
+ * ┌──────────┬──────┐
423
+ * │ s │ pos │
424
+ * ├──────────┼──────┤
425
+ * │ "apple" │ 0 │
426
+ * │ "banana" │ 1 │
427
+ * │ "cherry" │ null │
428
+ * └──────────┴──────┘
429
+ */
430
+ find(value: string | RegExp, options?: FindOptions): any;
431
+ /**
432
+ * Return the starting byte offset of each match for multiple patterns.
433
+ * @param patterns Array of regular expressions or literal search strings.
434
+ * @param options Configuration options ({ literal, asciiCaseInsensitive, overlapping, leftmost }).
435
+ * @returns ColumnExpression
436
+ * @example
437
+ * >>> const df = $df.data({ s: ["apple", "banana", "cherry"] })
438
+ * >>> df
439
+ * shape: (3, 1)
440
+ * ┌──────────┐
441
+ * │ s │
442
+ * ├──────────┤
443
+ * │ "apple" │
444
+ * │ "banana" │
445
+ * │ "cherry" │
446
+ * └──────────┘
447
+ * >>> df.withColumns($df.col("s").str.findMany(["a", "e"]).alias("positions"))
448
+ * shape: (3, 2)
449
+ * ┌──────────┬───────────┐
450
+ * │ s │ positions │
451
+ * ├──────────┼───────────┤
452
+ * │ "apple" │ [0, 4] │
453
+ * │ "banana" │ [1] │
454
+ * │ "cherry" │ [2] │
455
+ * └──────────┴───────────┘
456
+ */
457
+ findMany(patterns: (string | RegExp)[], options?: FindManyOptions): any;
458
+ /**
459
+ * Extracts the first n characters of each string element.
460
+ * @param n Number of characters to extract from the start of the string (default 1).
461
+ * @returns ColumnExpression
462
+ * @example
463
+ * >>> const df = $df.data({ s: ["apple", "banana", "cherry"] })
464
+ * >>> df
465
+ * shape: (3, 1)
466
+ * ┌──────────┐
467
+ * │ s │
468
+ * ├──────────┤
469
+ * │ "apple" │
470
+ * │ "banana" │
471
+ * │ "cherry" │
472
+ * └──────────┘
473
+ * >>> df.withColumns($df.col("s").str.head(3).alias("prefix"))
474
+ * shape: (3, 2)
475
+ * ┌──────────┬────────┐
476
+ * │ s │ prefix │
477
+ * ├──────────┼────────┤
478
+ * │ "apple" │ app │
479
+ * │ "banana" │ ban │
480
+ * │ "cherry" │ che │
481
+ * └──────────┴────────┘
482
+ */
483
+ head(n?: number): any;
484
+ /**
485
+ * Joins a list of string elements into a single string using a delimiter.
486
+ * Accepts `JoinArrayOptions` (`{ ignoreNulls, nullValue, prefix, suffix, limit, truncationMarker, valueFormatter }`).
487
+ * @param delimiter The string delimiter to join elements with.
488
+ * @param options Formatting configuration options (`JoinArrayOptions`).
489
+ * @returns ColumnExpression
490
+ * @example
491
+ * >>> const df = $df.data({ a: [[1, 2, 3], [4, 5]] })
492
+ * >>> df
493
+ * shape: (2, 1)
494
+ * ┌───────────┐
495
+ * │ a │
496
+ * ├───────────┤
497
+ * │ [1, 2, 3] │
498
+ * │ [4, 5] │
499
+ * └───────────┘
500
+ * >>> df.withColumns($df.col("a").str.join("-").alias("joined"))
501
+ * shape: (2, 2)
502
+ * ┌────────────┬────────┐
503
+ * │ a │ joined │
504
+ * ├────────────┼────────┤
505
+ * │ ["a", "b"] │ a-b │
506
+ * │ ["c"] │ c │
507
+ * └────────────┴────────┘
508
+ */
509
+ join(delimiter?: string, options?: JoinArrayOptions): any;
510
+ /**
511
+ * Decodes JSON string elements into parsed objects or arrays.
512
+ * Reuses safeJsonParse utility.
513
+ * @param options Configuration options for parsing (`SafeJsonParseOptions`).
514
+ * @returns ColumnExpression
515
+ * @example
516
+ * >>> const df = $df.data({ s: ["apple", "banana", "cherry"] })
517
+ * >>> df
518
+ * shape: (3, 1)
519
+ * ┌──────────┐
520
+ * │ s │
521
+ * ├──────────┤
522
+ * │ "apple" │
523
+ * │ "banana" │
524
+ * │ "cherry" │
525
+ * └──────────┘
526
+ * >>> df.withColumns($df.col("s").str.trim().str.jsonDecode().alias("parsed"))
527
+ * shape: (2, 2)
528
+ * ┌─────────────┬─────────┐
529
+ * │ s │ parsed │
530
+ * ├─────────────┼─────────┤
531
+ * │ " hello " │ "hello" │
532
+ * │ " world " │ "world" │
533
+ * └─────────────┴─────────┘
534
+ */
535
+ jsonDecode(options?: SafeJsonParseOptions): any;
536
+ /**
537
+ * Extracts fields or array elements from JSON strings using JSONPath syntax.
538
+ * @param jsonPath The JSONPath expression (e.g. `"$.store.book[0].title"` or `"$.a.b"`).
539
+ * @returns ColumnExpression
540
+ * @example
541
+ * >>> const df = $df.data({ s: ["apple", "banana", "cherry"] })
542
+ * >>> df
543
+ * shape: (3, 1)
544
+ * ┌──────────┐
545
+ * │ s │
546
+ * ├──────────┤
547
+ * │ "apple" │
548
+ * │ "banana" │
549
+ * │ "cherry" │
550
+ * └──────────┘
551
+ * >>> df.withColumns($df.col("s").str.trim().str.jsonPathMatch("$").alias("val"))
552
+ * shape: (2, 2)
553
+ * ┌─────────────┬─────────┐
554
+ * │ s │ val │
555
+ * ├─────────────┼─────────┤
556
+ * │ " hello " │ "hello" │
557
+ * │ " world " │ "world" │
558
+ * └─────────────┴─────────┘
559
+ */
560
+ jsonPathMatch(jsonPath: string): any;
561
+ /**
562
+ * Returns string length in UTF-16 code units. Alias for lenChars.
563
+ * @returns ColumnExpression
564
+ * @example
565
+ * >>> const df = $df.data({ s: ["apple", "banana", "cherry"] })
566
+ * >>> df
567
+ * shape: (3, 1)
568
+ * ┌──────────┐
569
+ * │ s │
570
+ * ├──────────┤
571
+ * │ "apple" │
572
+ * │ "banana" │
573
+ * │ "cherry" │
574
+ * └──────────┘
575
+ * >>> df.withColumns($df.col("s").str.len().alias("length"))
576
+ * shape: (3, 2)
577
+ * ┌──────────┬────────┐
578
+ * │ s │ length │
579
+ * ├──────────┼────────┤
580
+ * │ "apple" │ 5 │
581
+ * │ "banana" │ 6 │
582
+ * │ "cherry" │ 6 │
583
+ * └──────────┴────────┘
147
584
  */
148
585
  len(): any;
149
586
  /**
150
587
  * Returns string length in UTF-8 encoded bytes.
151
588
  * @returns ColumnExpression
152
589
  * @example
153
- * >>> const df = $df.data({ str: ["hello"] })
154
- * >>> df.with_columns($df.col("str").str.len_bytes().alias("bytes"))
155
- * shape: (1, 2)
156
- * ┌───────┬───────┐
157
- * │ str bytes │
158
- * ├───────┼───────┤
159
- * │ hello 5 │
160
- * └───────┴───────┘
590
+ * >>> const df = $df.data({ s: ["apple", "banana", "cherry"] })
591
+ * >>> df
592
+ * shape: (3, 1)
593
+ * ┌──────────┐
594
+ * │ s
595
+ * ├──────────┤
596
+ * │ "apple"
597
+ * │ "banana" │
598
+ * │ "cherry" │
599
+ * └──────────┘
600
+ * >>> df.withColumns($df.col("s").str.lenBytes().alias("bytes"))
601
+ * shape: (3, 2)
602
+ * ┌──────────┬───────┐
603
+ * │ s │ bytes │
604
+ * ├──────────┼───────┤
605
+ * │ "apple" │ 5 │
606
+ * │ "banana" │ 6 │
607
+ * │ "cherry" │ 6 │
608
+ * └──────────┴───────┘
161
609
  */
162
- len_bytes(): any;
610
+ lenBytes(): any;
163
611
  /**
164
612
  * Returns string length in character count.
165
613
  * @returns ColumnExpression
166
614
  * @example
167
- * >>> const df = $df.data({ text: ["hello"] })
168
- * >>> df.with_columns($df.col("text").str.len_chars().alias("length"))
169
- * shape: (1, 2)
170
- * ┌───────┬────────┐
171
- * │ text length │
172
- * ├───────┼────────┤
173
- * │ hello 5 │
174
- * └───────┴────────┘
615
+ * >>> const df = $df.data({ s: ["apple", "banana", "cherry"] })
616
+ * >>> df
617
+ * shape: (3, 1)
618
+ * ┌──────────┐
619
+ * │ s
620
+ * ├──────────┤
621
+ * │ "apple"
622
+ * │ "banana" │
623
+ * │ "cherry" │
624
+ * └──────────┘
625
+ * >>> df.withColumns($df.col("s").str.lenChars().alias("length"))
626
+ * shape: (3, 2)
627
+ * ┌──────────┬────────┐
628
+ * │ s │ length │
629
+ * ├──────────┼────────┤
630
+ * │ "apple" │ 5 │
631
+ * │ "banana" │ 6 │
632
+ * │ "cherry" │ 6 │
633
+ * └──────────┴────────┘
175
634
  */
176
- len_chars(): any;
635
+ lenChars(): any;
177
636
  /**
178
637
  * Converts strings to lowercase.
179
638
  * @returns ColumnExpression
180
639
  * @example
181
- * >>> const df = $df.data({ str: ["HELLO"] })
182
- * >>> df.with_columns($df.col("str").str.lower().alias("lowered"))
183
- * shape: (1, 2)
184
- * ┌───────┬─────────┐
185
- * │ str lowered │
186
- * ├───────┼─────────┤
187
- * │ HELLO hello │
188
- * └───────┴─────────┘
640
+ * >>> const df = $df.data({ s: ["apple", "banana", "cherry"] })
641
+ * >>> df
642
+ * shape: (3, 1)
643
+ * ┌──────────┐
644
+ * │ s
645
+ * ├──────────┤
646
+ * │ "apple"
647
+ * │ "banana" │
648
+ * │ "cherry" │
649
+ * └──────────┘
650
+ * >>> df.withColumns($df.col("s").str.lower().alias("lowered"))
651
+ * shape: (3, 2)
652
+ * ┌─────────────┬───────────┐
653
+ * │ s │ lowered │
654
+ * ├─────────────┼───────────┤
655
+ * │ "HELLO" │ hello │
656
+ * │ "World" │ world │
657
+ * │ "df-script" │ df-script │
658
+ * └─────────────┴───────────┘
189
659
  */
190
660
  lower(): any;
191
661
  /**
@@ -194,92 +664,215 @@ export declare class StringExprNamespace {
194
664
  * @param fill Character sequence used for padding.
195
665
  * @returns ColumnExpression
196
666
  * @example
197
- * >>> const df = $df.data({ num: ["5"] })
198
- * >>> df.with_columns($df.col("num").str.lpad(3, "0").alias("padded"))
199
- * shape: (1, 2)
200
- * ┌─────┬────────┐
201
- * │ num padded │
202
- * ├─────┼────────┤
203
- * │ 5 005 │
204
- * └─────┴────────┘
667
+ * >>> const df = $df.data({ s: ["apple", "banana", "cherry"] })
668
+ * >>> df
669
+ * shape: (3, 1)
670
+ * ┌──────────┐
671
+ * │ s
672
+ * ├──────────┤
673
+ * │ "apple"
674
+ * │ "banana" │
675
+ * │ "cherry" │
676
+ * └──────────┘
677
+ * >>> df.withColumns($df.col("s").str.lpad(8, "_").alias("padded"))
678
+ * shape: (3, 2)
679
+ * ┌──────────┬──────────┐
680
+ * │ s │ padded │
681
+ * ├──────────┼──────────┤
682
+ * │ "apple" │ ___apple │
683
+ * │ "banana" │ __banana │
684
+ * │ "cherry" │ __cherry │
685
+ * └──────────┴──────────┘
205
686
  */
206
687
  lpad(width: number, fill?: string): any;
688
+ /**
689
+ * Normalizes Unicode strings using standard normalization forms (NFC, NFD, NFKC, NFKD).
690
+ * @param form The Unicode normalization form to apply ("NFC", "NFD", "NFKC", or "NFKD"). Default is "NFC".
691
+ * @returns ColumnExpression
692
+ * @throws InvalidArgumentError If an invalid normalization form is provided.
693
+ * @example
694
+ * >>> const df = $df.data({ s: ["apple", "banana", "cherry"] })
695
+ * >>> df
696
+ * shape: (3, 1)
697
+ * ┌──────────┐
698
+ * │ s │
699
+ * ├──────────┤
700
+ * │ "apple" │
701
+ * │ "banana" │
702
+ * │ "cherry" │
703
+ * └──────────┘
704
+ * >>> df.withColumns($df.col("s").str.normalize("NFC").alias("normalized"))
705
+ * shape: (3, 2)
706
+ * ┌─────────────┬────────────┐
707
+ * │ s │ normalized │
708
+ * ├─────────────┼────────────┤
709
+ * │ "HELLO" │ HELLO │
710
+ * │ "World" │ World │
711
+ * │ "df-script" │ df-script │
712
+ * └─────────────┴────────────┘
713
+ */
714
+ normalize(form?: Parameters<typeof String.prototype.normalize>[0]): any;
207
715
  /**
208
716
  * Pads end of strings to specified width. Alias for rpad.
209
717
  * @param width Target string length.
210
718
  * @param fill Character sequence used for padding.
211
719
  * @returns ColumnExpression
212
720
  * @example
213
- * >>> const df = $df.data({ text: ["a"] })
214
- * >>> df.with_columns($df.col("text").str.pad_end(3, "-").alias("padded"))
215
- * shape: (1, 2)
216
- * ┌──────┬────────┐
217
- * │ text padded │
218
- * ├──────┼────────┤
219
- * │ a a-- │
220
- * └──────┴────────┘
721
+ * >>> const df = $df.data({ s: ["apple", "banana", "cherry"] })
722
+ * >>> df
723
+ * shape: (3, 1)
724
+ * ┌──────────┐
725
+ * │ s
726
+ * ├──────────┤
727
+ * │ "apple"
728
+ * │ "banana" │
729
+ * │ "cherry" │
730
+ * └──────────┘
731
+ * >>> df.withColumns($df.col("s").str.padEnd(8, "_").alias("padded"))
732
+ * shape: (3, 2)
733
+ * ┌──────────┬──────────┐
734
+ * │ s │ padded │
735
+ * ├──────────┼──────────┤
736
+ * │ "apple" │ apple___ │
737
+ * │ "banana" │ banana__ │
738
+ * │ "cherry" │ cherry__ │
739
+ * └──────────┴──────────┘
221
740
  */
222
- pad_end(width: number, fill?: string): any;
741
+ padEnd(width: number, fill?: string): any;
223
742
  /**
224
743
  * Pads start of strings to specified width. Alias for lpad.
225
744
  * @param width Target string length.
226
745
  * @param fill Character sequence used for padding.
227
746
  * @returns ColumnExpression
228
747
  * @example
229
- * >>> const df = $df.data({ num: ["5"] })
230
- * >>> df.with_columns($df.col("num").str.pad_start(3, "0").alias("padded"))
231
- * shape: (1, 2)
232
- * ┌─────┬────────┐
233
- * │ num padded │
234
- * ├─────┼────────┤
235
- * │ 5 005 │
236
- * └─────┴────────┘
748
+ * >>> const df = $df.data({ s: ["apple", "banana", "cherry"] })
749
+ * >>> df
750
+ * shape: (3, 1)
751
+ * ┌──────────┐
752
+ * │ s
753
+ * ├──────────┤
754
+ * │ "apple"
755
+ * │ "banana" │
756
+ * │ "cherry" │
757
+ * └──────────┘
758
+ * >>> df.withColumns($df.col("s").str.padStart(8, "_").alias("padded"))
759
+ * shape: (3, 2)
760
+ * ┌──────────┬──────────┐
761
+ * │ s │ padded │
762
+ * ├──────────┼──────────┤
763
+ * │ "apple" │ ___apple │
764
+ * │ "banana" │ __banana │
765
+ * │ "cherry" │ __cherry │
766
+ * └──────────┴──────────┘
237
767
  */
238
- pad_start(width: number, fill?: string): any;
768
+ padStart(width: number, fill?: string): any;
239
769
  /**
240
770
  * Replaces the first occurrence matching a string pattern.
241
771
  * @param pattern The search pattern string or regular expression.
242
772
  * @param replacement The string value or match replacement function.
773
+ * @param options Optional replace options (literal, asciiCaseInsensitive, n).
243
774
  * @returns ColumnExpression
244
775
  * @example
245
- * >>> const df = $df.data({ email: ["old.com"] })
246
- * >>> df.with_columns($df.col("email").str.replace("old.com", "new.com").alias("updated"))
247
- * shape: (1, 2)
248
- * ┌─────────┬─────────┐
249
- * │ email updated │
250
- * ├─────────┼─────────┤
251
- * │ old.com new.com │
252
- * └─────────┴─────────┘
776
+ * >>> const df = $df.data({ s: ["apple", "banana", "cherry"] })
777
+ * >>> df
778
+ * shape: (3, 1)
779
+ * ┌──────────┐
780
+ * │ s
781
+ * ├──────────┤
782
+ * │ "apple"
783
+ * │ "banana" │
784
+ * │ "cherry" │
785
+ * └──────────┘
786
+ * >>> df.withColumns($df.col("email").str.replace("example", "test").alias("updated"))
787
+ * shape: (2, 2)
788
+ * ┌──────────────────┬───────────────┐
789
+ * │ email │ updated │
790
+ * ├──────────────────┼───────────────┤
791
+ * │ user@example.com │ user@test.com │
792
+ * │ admin@test.org │ admin@test.org│
793
+ * └──────────────────┴───────────────┘
253
794
  */
254
- replace(pattern: string | RegExp, replacement: string | ((match: string, ...args: any[]) => string)): any;
795
+ replace(pattern: string | RegExp, replacement: string | ((match: string, ...args: any[]) => string), options?: ReplaceOptions): any;
255
796
  /**
256
797
  * Replaces all occurrences matching a string pattern or global regular expression.
257
798
  * @param pattern The search pattern string or regular expression.
258
799
  * @param replacement The replacement value.
800
+ * @param options Optional replace options (literal, asciiCaseInsensitive).
259
801
  * @returns ColumnExpression
260
802
  * @example
261
- * >>> const df = $df.data({ text: ["foo bar foo"] })
262
- * >>> df.with_columns($df.col("text").str.replace_all("foo", "baz").alias("replaced"))
263
- * shape: (1, 2)
264
- * ┌─────────────┬─────────────┐
265
- * │ text replaced │
266
- * ├─────────────┼─────────────┤
267
- * │ foo bar foo baz bar baz │
268
- * └─────────────┴─────────────┘
803
+ * >>> const df = $df.data({ s: ["apple", "banana", "cherry"] })
804
+ * >>> df
805
+ * shape: (3, 1)
806
+ * ┌──────────┐
807
+ * │ s
808
+ * ├──────────┤
809
+ * │ "apple"
810
+ * │ "banana" │
811
+ * │ "cherry" │
812
+ * └──────────┘
813
+ * >>> df.withColumns($df.col("s").str.replaceAll("a", "@").alias("replaced"))
814
+ * shape: (3, 2)
815
+ * ┌──────────┬──────────┐
816
+ * │ s │ replaced │
817
+ * ├──────────┼──────────┤
818
+ * │ "apple" │ @pple │
819
+ * │ "banana" │ b@n@n@ │
820
+ * │ "cherry" │ cherry │
821
+ * └──────────┴──────────┘
269
822
  */
270
- replace_all(pattern: string | RegExp, replacement: string | ((match: string, ...args: any[]) => string)): any;
823
+ replaceAll(pattern: string | RegExp, replacement: string | ((match: string, ...args: any[]) => string), options?: Omit<ReplaceOptions, "n">): any;
824
+ /**
825
+ * Replaces multiple string patterns simultaneously or sequentially with their respective replacements.
826
+ * Matches Polars `.str.replaceMany()` behavior, accepting pattern/replacement arrays or a pattern-to-replacement map dictionary.
827
+ * @param patterns Array of patterns or an object mapping target patterns to replacements.
828
+ * @param replacements Array of replacement strings/callbacks (when patterns is an array).
829
+ * @param options Configuration options ({ literal, asciiCaseInsensitive, mode }).
830
+ * @returns ColumnExpression
831
+ * @example
832
+ * >>> const df = $df.data({ s: ["apple", "banana", "cherry"] })
833
+ * >>> df
834
+ * shape: (3, 1)
835
+ * ┌──────────┐
836
+ * │ s │
837
+ * ├──────────┤
838
+ * │ "apple" │
839
+ * │ "banana" │
840
+ * │ "cherry" │
841
+ * └──────────┘
842
+ * >>> df.withColumns($df.col("s").str.replaceMany(["apple", "banana"], ["1", "2"]).alias("res"))
843
+ * shape: (3, 2)
844
+ * ┌──────────┬────────┐
845
+ * │ s │ res │
846
+ * ├──────────┼────────┤
847
+ * │ "apple" │ 1 │
848
+ * │ "banana" │ 2 │
849
+ * │ "cherry" │ cherry │
850
+ * └──────────┴────────┘
851
+ */
852
+ replaceMany(patterns: (string | RegExp)[] | Record<string, string>, replacements?: (string | ((match: string, ...args: any[]) => string))[], options?: ReplaceManyOptions): any;
271
853
  /**
272
854
  * Reverses characters in each string element.
273
855
  * @returns ColumnExpression
274
856
  * @example
275
- * >>> const df = $df.data({ str: ["abc"] })
276
- * >>> df.with_columns($df.col("str").str.reverse().alias("rev"))
277
- * shape: (1, 2)
278
- * ┌─────┬─────┐
279
- * │ str rev │
280
- * ├─────┼─────┤
281
- * │ abc cba │
282
- * └─────┴─────┘
857
+ * >>> const df = $df.data({ s: ["apple", "banana", "cherry"] })
858
+ * >>> df
859
+ * shape: (3, 1)
860
+ * ┌──────────┐
861
+ * │ s
862
+ * ├──────────┤
863
+ * │ "apple"
864
+ * │ "banana" │
865
+ * │ "cherry" │
866
+ * └──────────┘
867
+ * >>> df.withColumns($df.col("s").str.reverse().alias("rev"))
868
+ * shape: (3, 2)
869
+ * ┌──────────┬────────┐
870
+ * │ s │ rev │
871
+ * ├──────────┼────────┤
872
+ * │ "apple" │ elppa │
873
+ * │ "banana" │ ananab │
874
+ * │ "cherry" │ yrrehc │
875
+ * └──────────┴────────┘
283
876
  */
284
877
  reverse(): any;
285
878
  /**
@@ -288,14 +881,25 @@ export declare class StringExprNamespace {
288
881
  * @param fill Character sequence used for padding.
289
882
  * @returns ColumnExpression
290
883
  * @example
291
- * >>> const df = $df.data({ text: ["a"] })
292
- * >>> df.with_columns($df.col("text").str.rpad(3, "-").alias("padded"))
293
- * shape: (1, 2)
294
- * ┌──────┬────────┐
295
- * │ text padded │
296
- * ├──────┼────────┤
297
- * │ a a-- │
298
- * └──────┴────────┘
884
+ * >>> const df = $df.data({ s: ["apple", "banana", "cherry"] })
885
+ * >>> df
886
+ * shape: (3, 1)
887
+ * ┌──────────┐
888
+ * │ s
889
+ * ├──────────┤
890
+ * │ "apple"
891
+ * │ "banana" │
892
+ * │ "cherry" │
893
+ * └──────────┘
894
+ * >>> df.withColumns($df.col("s").str.rpad(8, "_").alias("padded"))
895
+ * shape: (3, 2)
896
+ * ┌──────────┬──────────┐
897
+ * │ s │ padded │
898
+ * ├──────────┼──────────┤
899
+ * │ "apple" │ apple___ │
900
+ * │ "banana" │ banana__ │
901
+ * │ "cherry" │ cherry__ │
902
+ * └──────────┴──────────┘
299
903
  */
300
904
  rpad(width: number, fill?: string): any;
301
905
  /**
@@ -304,132 +908,250 @@ export declare class StringExprNamespace {
304
908
  * @param length Number of characters to include.
305
909
  * @returns ColumnExpression
306
910
  * @example
307
- * >>> const df = $df.data({ str: ["hello world"] })
308
- * >>> df.with_columns($df.col("str").str.slice(0, 5).alias("sub"))
309
- * shape: (1, 2)
310
- * ┌─────────────┬───────┐
311
- * │ str sub │
312
- * ├─────────────┼───────┤
313
- * │ hello world hello │
314
- * └─────────────┴───────┘
911
+ * >>> const df = $df.data({ s: ["apple", "banana", "cherry"] })
912
+ * >>> df
913
+ * shape: (3, 1)
914
+ * ┌──────────┐
915
+ * │ s
916
+ * ├──────────┤
917
+ * │ "apple"
918
+ * │ "banana" │
919
+ * │ "cherry" │
920
+ * └──────────┘
921
+ * >>> df.withColumns($df.col("s").str.slice(0, 3).alias("sub"))
922
+ * shape: (3, 2)
923
+ * ┌──────────┬─────┐
924
+ * │ s │ sub │
925
+ * ├──────────┼─────┤
926
+ * │ "apple" │ app │
927
+ * │ "banana" │ ban │
928
+ * │ "cherry" │ che │
929
+ * └──────────┴─────┘
315
930
  */
316
931
  slice(offset: number, length?: number): any;
317
932
  /**
318
- * Splits strings into lists by delimiter.
933
+ * Splits strings into lists by delimiter with optional limit and exact padding.
319
934
  * @param delimiter Substring delimiter.
935
+ * @param options Options for controlling limit and exact padding.
320
936
  * @returns ColumnExpression
321
937
  * @example
322
- * >>> const df = $df.data({ csv: ["a,b,c"] })
323
- * >>> df.with_columns($df.col("csv").str.split(",").alias("items"))
324
- * shape: (1, 2)
325
- * ┌───────┬─────────────────┐
326
- * │ csv items │
327
- * ├───────┼─────────────────┤
328
- * │ a,b,c │ ["a", "b", "c"]
329
- * └───────┴─────────────────┘
938
+ * >>> const df = $df.data({ s: ["apple", "banana", "cherry"] })
939
+ * >>> df
940
+ * shape: (3, 1)
941
+ * ┌──────────┐
942
+ * │ s
943
+ * ├──────────┤
944
+ * │ "apple"
945
+ * │ "banana" │
946
+ * │ "cherry" │
947
+ * └──────────┘
948
+ * >>> df.withColumns($df.col("email").str.split("@").alias("parts"))
949
+ * shape: (2, 2)
950
+ * ┌──────────────────┬────────────────────────┐
951
+ * │ email │ parts │
952
+ * ├──────────────────┼────────────────────────┤
953
+ * │ user@example.com │ ["user", "example.com"]│
954
+ * │ admin@test.org │ ["admin", "test.org"] │
955
+ * └──────────────────┴────────────────────────┘
330
956
  */
331
- split(delimiter: string): any;
957
+ split(delimiter: string, options?: SplitOptions): any;
332
958
  /**
333
959
  * Checks if string starts with a prefix.
334
960
  * @param prefix The prefix substring.
335
961
  * @returns ColumnExpression
336
962
  * @example
337
- * >>> const df = $df.data({ name: ["John Doe", "Alice"] })
338
- * >>> df.with_columns($df.col("name").str.starts_with("John").alias("is_john"))
339
- * shape: (2, 2)
340
- * ┌──────────┬─────────┐
341
- * │ name is_john │
342
- * ├──────────┼─────────┤
343
- * │ John Doe true │
344
- * │ Alice │ false
345
- * └──────────┴─────────┘
963
+ * >>> const df = $df.data({ s: ["apple", "banana", "cherry"] })
964
+ * >>> df
965
+ * shape: (3, 1)
966
+ * ┌──────────┐
967
+ * │ s
968
+ * ├──────────┤
969
+ * │ "apple"
970
+ * │ "banana"
971
+ * │ "cherry" │
972
+ * └──────────┘
973
+ * >>> df.withColumns($df.col("s").str.startsWith("a").alias("starts_a"))
974
+ * shape: (3, 2)
975
+ * ┌──────────┬──────────┐
976
+ * │ s │ starts_a │
977
+ * ├──────────┼──────────┤
978
+ * │ "apple" │ true │
979
+ * │ "banana" │ false │
980
+ * │ "cherry" │ false │
981
+ * └──────────┴──────────┘
346
982
  */
347
- starts_with(prefix: string): any;
983
+ startsWith(prefix: string): any;
348
984
  /**
349
985
  * Strips matching characters from start and end of string.
350
986
  * @param characters Characters or regex pattern to strip.
351
987
  * @param options Configuration options for strip operation.
352
988
  * @returns ColumnExpression
353
989
  * @example
354
- * >>> const df = $df.data({ text: ["--hello--"] })
355
- * >>> df.with_columns($df.col("text").str.strip_chars("-").alias("stripped"))
356
- * shape: (1, 2)
357
- * ┌───────────┬──────────┐
358
- * │ text stripped │
359
- * ├───────────┼──────────┤
360
- * │ --hello-- hello │
361
- * └───────────┴──────────┘
990
+ * >>> const df = $df.data({ s: ["apple", "banana", "cherry"] })
991
+ * >>> df
992
+ * shape: (3, 1)
993
+ * ┌──────────┐
994
+ * │ s
995
+ * ├──────────┤
996
+ * │ "apple"
997
+ * │ "banana" │
998
+ * │ "cherry" │
999
+ * └──────────┘
1000
+ * >>> df.withColumns($df.col("s").str.stripChars().alias("stripped"))
1001
+ * shape: (2, 2)
1002
+ * ┌─────────────┬──────────┐
1003
+ * │ s │ stripped │
1004
+ * ├─────────────┼──────────┤
1005
+ * │ " hello " │ hello │
1006
+ * │ " world " │ world │
1007
+ * └─────────────┴──────────┘
362
1008
  */
363
- strip_chars(characters?: string | RegExp, options?: StripCharsOptions): any;
1009
+ stripChars(characters?: string | RegExp, options?: StripCharsOptions): any;
364
1010
  /**
365
1011
  * Strips matching characters from end of string.
366
1012
  * @param characters Characters or regex pattern to strip.
367
1013
  * @param options Configuration options.
368
1014
  * @returns ColumnExpression
369
1015
  * @example
370
- * >>> const df = $df.data({ text: ["hello--"] })
371
- * >>> df.with_columns($df.col("text").str.strip_chars_end("-").alias("stripped"))
372
- * shape: (1, 2)
373
- * ┌─────────┬──────────┐
374
- * │ text stripped │
375
- * ├─────────┼──────────┤
376
- * │ hello-- hello │
377
- * └─────────┴──────────┘
1016
+ * >>> const df = $df.data({ s: ["apple", "banana", "cherry"] })
1017
+ * >>> df
1018
+ * shape: (3, 1)
1019
+ * ┌──────────┐
1020
+ * │ s
1021
+ * ├──────────┤
1022
+ * │ "apple"
1023
+ * │ "banana" │
1024
+ * │ "cherry" │
1025
+ * └──────────┘
1026
+ * >>> df.withColumns($df.col("s").str.stripCharsEnd().alias("stripped"))
1027
+ * shape: (2, 2)
1028
+ * ┌─────────────┬──────────┐
1029
+ * │ s │ stripped │
1030
+ * ├─────────────┼──────────┤
1031
+ * │ " hello " │ " hello" │
1032
+ * │ " world " │ " world" │
1033
+ * └─────────────┴──────────┘
378
1034
  */
379
- strip_chars_end(characters?: string | RegExp, options?: StripCharsOptions): any;
1035
+ stripCharsEnd(characters?: string | RegExp, options?: StripCharsOptions): any;
380
1036
  /**
381
1037
  * Strips matching characters from start of string.
382
1038
  * @param characters Characters or regex pattern to strip.
383
1039
  * @param options Configuration options.
384
1040
  * @returns ColumnExpression
385
1041
  * @example
386
- * >>> const df = $df.data({ text: ["--hello"] })
387
- * >>> df.with_columns($df.col("text").str.strip_chars_start("-").alias("stripped"))
388
- * shape: (1, 2)
389
- * ┌─────────┬──────────┐
390
- * │ text stripped │
391
- * ├─────────┼──────────┤
392
- * │ --hello hello │
393
- * └─────────┴──────────┘
1042
+ * >>> const df = $df.data({ s: ["apple", "banana", "cherry"] })
1043
+ * >>> df
1044
+ * shape: (3, 1)
1045
+ * ┌──────────┐
1046
+ * │ s
1047
+ * ├──────────┤
1048
+ * │ "apple"
1049
+ * │ "banana" │
1050
+ * │ "cherry" │
1051
+ * └──────────┘
1052
+ * >>> df.withColumns($df.col("s").str.stripCharsStart().alias("stripped"))
1053
+ * shape: (2, 2)
1054
+ * ┌─────────────┬──────────┐
1055
+ * │ s │ stripped │
1056
+ * ├─────────────┼──────────┤
1057
+ * │ " hello " │ "hello " │
1058
+ * │ " world " │ "world " │
1059
+ * └─────────────┴──────────┘
394
1060
  */
395
- strip_chars_start(characters?: string | RegExp, options?: StripCharsOptions): any;
1061
+ stripCharsStart(characters?: string | RegExp, options?: StripCharsOptions): any;
396
1062
  /**
397
1063
  * Strips matching prefix substring from start of string.
398
1064
  * @param prefix Prefix substring to remove.
399
1065
  * @returns ColumnExpression
400
1066
  * @example
401
- * >>> const df = $df.data({ text: ["pre_fix"] })
402
- * >>> df.with_columns($df.col("text").str.strip_prefix("pre_").alias("stripped"))
403
- * shape: (1, 2)
404
- * ┌─────────┬──────────┐
405
- * │ text stripped │
406
- * ├─────────┼──────────┤
407
- * │ pre_fix fix │
408
- * └─────────┴──────────┘
1067
+ * >>> const df = $df.data({ s: ["apple", "banana", "cherry"] })
1068
+ * >>> df
1069
+ * shape: (3, 1)
1070
+ * ┌──────────┐
1071
+ * │ s
1072
+ * ├──────────┤
1073
+ * │ "apple"
1074
+ * │ "banana" │
1075
+ * │ "cherry" │
1076
+ * └──────────┘
1077
+ * >>> df.withColumns($df.col("s").str.stripPrefix("df-").alias("stripped"))
1078
+ * shape: (3, 2)
1079
+ * ┌─────────────┬──────────┐
1080
+ * │ s │ stripped │
1081
+ * ├─────────────┼──────────┤
1082
+ * │ "HELLO" │ HELLO │
1083
+ * │ "World" │ World │
1084
+ * │ "df-script" │ script │
1085
+ * └─────────────┴──────────┘
409
1086
  */
410
- strip_prefix(prefix: string): any;
1087
+ stripPrefix(prefix: string): any;
411
1088
  /**
412
1089
  * Strips matching suffix substring from end of string.
413
1090
  * @param suffix Suffix substring to remove.
414
1091
  * @returns ColumnExpression
415
1092
  * @example
416
- * >>> const df = $df.data({ text: ["fix_post"] })
417
- * >>> df.with_columns($df.col("text").str.strip_suffix("_post").alias("stripped"))
418
- * shape: (1, 2)
419
- * ┌──────────┬──────────┐
420
- * │ text stripped │
421
- * ├──────────┼──────────┤
422
- * │ fix_post fix │
423
- * └──────────┴──────────┘
1093
+ * >>> const df = $df.data({ s: ["apple", "banana", "cherry"] })
1094
+ * >>> df
1095
+ * shape: (3, 1)
1096
+ * ┌──────────┐
1097
+ * │ s
1098
+ * ├──────────┤
1099
+ * │ "apple"
1100
+ * │ "banana" │
1101
+ * │ "cherry" │
1102
+ * └──────────┘
1103
+ * >>> df.withColumns($df.col("email").str.stripSuffix(".com").alias("stripped"))
1104
+ * shape: (2, 2)
1105
+ * ┌──────────────────┬────────────────┐
1106
+ * │ email │ stripped │
1107
+ * ├──────────────────┼────────────────┤
1108
+ * │ user@example.com │ user@example │
1109
+ * │ admin@test.org │ admin@test.org │
1110
+ * └──────────────────┴────────────────┘
1111
+ */
1112
+ stripSuffix(suffix: string): any;
1113
+ /**
1114
+ * Extracts the last n characters of each string element.
1115
+ * @param n Number of characters to extract from the end of the string (default 1).
1116
+ * @returns ColumnExpression
1117
+ * @example
1118
+ * >>> const df = $df.data({ s: ["apple", "banana", "cherry"] })
1119
+ * >>> df
1120
+ * shape: (3, 1)
1121
+ * ┌──────────┐
1122
+ * │ s │
1123
+ * ├──────────┤
1124
+ * │ "apple" │
1125
+ * │ "banana" │
1126
+ * │ "cherry" │
1127
+ * └──────────┘
1128
+ * >>> df.withColumns($df.col("s").str.tail(3).alias("suffix"))
1129
+ * shape: (3, 2)
1130
+ * ┌──────────┬────────┐
1131
+ * │ s │ suffix │
1132
+ * ├──────────┼────────┤
1133
+ * │ "apple" │ ple │
1134
+ * │ "banana" │ ana │
1135
+ * │ "cherry" │ rry │
1136
+ * └──────────┴────────┘
424
1137
  */
425
- strip_suffix(suffix: string): any;
1138
+ tail(n?: number): any;
426
1139
  /**
427
1140
  * Parses date/time string into Datetime.
1141
+ * @note [Timezone Compatibility]: Direct string parsing with timezone offsets relies on native `Intl.DateTimeFormat`
1142
+ * and `Date.UTC`. Unrecognized timezone identifiers safely default to `"UTC"`.
428
1143
  * @param options Parsing configuration options.
429
1144
  * @returns ColumnExpression
430
1145
  * @example
431
- * >>> const df = $df.data({ d: ["2026-05-20"] })
432
- * >>> df.with_columns($df.col("d").str.strptime({ format: "%Y-%m-%d" }).alias("parsed"))
1146
+ * >>> const df = $df.data({ date: ["2026-05-20T10:00:00.123Z"] })
1147
+ * >>> df
1148
+ * shape: (1, 1)
1149
+ * ┌──────────────────────────┐
1150
+ * │ date │
1151
+ * ├──────────────────────────┤
1152
+ * │ 2026-05-20T10:00:00.123Z │
1153
+ * └──────────────────────────┘
1154
+ * >>> df.withColumns($df.col("d").str.strptime({ format: "%Y-%m-%d" }).alias("parsed"))
433
1155
  * shape: (1, 2)
434
1156
  * ┌────────────┬──────────────────────────┐
435
1157
  * │ d │ parsed │
@@ -442,22 +1164,40 @@ export declare class StringExprNamespace {
442
1164
  * Converts string casing to camelCase.
443
1165
  * @returns ColumnExpression
444
1166
  * @example
445
- * >>> const df = $df.data({ text: ["hello_world"] })
446
- * >>> df.with_columns($df.col("text").str.to_camelcase().alias("camel"))
447
- * shape: (1, 2)
448
- * ┌─────────────┬────────────┐
449
- * │ text camel │
450
- * ├─────────────┼────────────┤
451
- * │ hello_world helloWorld │
452
- * └─────────────┴────────────┘
1167
+ * >>> const df = $df.data({ s: ["apple", "banana", "cherry"] })
1168
+ * >>> df
1169
+ * shape: (3, 1)
1170
+ * ┌──────────┐
1171
+ * │ s
1172
+ * ├──────────┤
1173
+ * │ "apple"
1174
+ * │ "banana" │
1175
+ * │ "cherry" │
1176
+ * └──────────┘
1177
+ * >>> df.withColumns($df.col("s").str.toCamelCase().alias("camel"))
1178
+ * shape: (3, 2)
1179
+ * ┌─────────────┬───────────┐
1180
+ * │ s │ camel │
1181
+ * ├─────────────┼───────────┤
1182
+ * │ "HELLO" │ hello │
1183
+ * │ "World" │ world │
1184
+ * │ "df-script" │ dfScript │
1185
+ * └─────────────┴───────────┘
453
1186
  */
454
- to_camelcase(): any;
1187
+ toCamelCase(): any;
455
1188
  /**
456
1189
  * Parses string into Date object.
457
1190
  * @returns ColumnExpression
458
1191
  * @example
459
- * >>> const df = $df.data({ d: ["2026-05-20"] })
460
- * >>> df.with_columns($df.col("d").str.to_date().alias("date"))
1192
+ * >>> const df = $df.data({ date: ["2026-05-20T10:00:00.123Z"] })
1193
+ * >>> df
1194
+ * shape: (1, 1)
1195
+ * ┌──────────────────────────┐
1196
+ * │ date │
1197
+ * ├──────────────────────────┤
1198
+ * │ 2026-05-20T10:00:00.123Z │
1199
+ * └──────────────────────────┘
1200
+ * >>> df.withColumns($df.col("d").str.toDate().alias("date"))
461
1201
  * shape: (1, 2)
462
1202
  * ┌────────────┬──────────────────────────┐
463
1203
  * │ d │ date │
@@ -465,216 +1205,350 @@ export declare class StringExprNamespace {
465
1205
  * │ 2026-05-20 │ 2026-05-20T00:00:00.000Z │
466
1206
  * └────────────┴──────────────────────────┘
467
1207
  */
468
- to_date(): any;
1208
+ toDate(): any;
469
1209
  /**
470
1210
  * Parses string into Datetime value.
471
1211
  * @returns ColumnExpression
472
1212
  * @example
473
- * >>> const df = $df.data({ ts: ["2026-05-20T10:00:00Z"] })
474
- * >>> df.with_columns($df.col("ts").str.to_datetime().alias("dt"))
1213
+ * >>> const df = $df.data({ date: ["2026-05-20T10:00:00.123Z"] })
1214
+ * >>> df
1215
+ * shape: (1, 1)
1216
+ * ┌──────────────────────────┐
1217
+ * │ date │
1218
+ * ├──────────────────────────┤
1219
+ * │ 2026-05-20T10:00:00.123Z │
1220
+ * └──────────────────────────┘
1221
+ * >>> df.withColumns($df.col("d").str.toDatetime().alias("dt"))
475
1222
  * shape: (1, 2)
476
- * ┌──────────────────────┬──────────────────────────┐
477
- * │ ts │ dt │
478
- * ├──────────────────────┼──────────────────────────┤
479
- * │ 2026-05-20T10:00:00Z │ 2026-05-20T10:00:00.000Z │
480
- * └──────────────────────┴──────────────────────────┘
1223
+ * ┌────────────┬──────────────────────────┐
1224
+ * │ d │ dt │
1225
+ * ├────────────┼──────────────────────────┤
1226
+ * │ 2026-05-20 │ 2026-05-20T00:00:00.000Z │
1227
+ * └────────────┴──────────────────────────┘
481
1228
  */
482
- to_datetime(): any;
1229
+ toDatetime(): any;
483
1230
  /**
484
1231
  * Converts string into numeric decimal representation.
485
1232
  * @param precision Optional precision limit.
486
1233
  * @param scale Optional scale limit.
487
1234
  * @returns ColumnExpression
488
1235
  * @example
489
- * >>> const df = $df.data({ val: ["12.34"] })
490
- * >>> df.with_columns($df.col("val").str.to_decimal().alias("num"))
491
- * shape: (1, 2)
492
- * ┌───────┬───────┐
493
- * │ val num │
494
- * ├───────┼───────┤
495
- * │ 12.34 12.34 │
496
- * └───────┴───────┘
1236
+ * >>> const df = $df.data({ s: ["apple", "banana", "cherry"] })
1237
+ * >>> df
1238
+ * shape: (3, 1)
1239
+ * ┌──────────┐
1240
+ * │ s
1241
+ * ├──────────┤
1242
+ * │ "apple"
1243
+ * │ "banana" │
1244
+ * │ "cherry" │
1245
+ * └──────────┘
1246
+ * >>> df.withColumns($df.col("s").str.len().str.toDecimal().alias("num"))
1247
+ * shape: (3, 2)
1248
+ * ┌──────────┬─────┐
1249
+ * │ s │ num │
1250
+ * ├──────────┼─────┤
1251
+ * │ "apple" │ 5 │
1252
+ * │ "banana" │ 6 │
1253
+ * │ "cherry" │ 6 │
1254
+ * └──────────┴─────┘
497
1255
  */
498
- to_decimal(precision?: number, scale?: number): any;
1256
+ toDecimal(precision?: number, scale?: number): any;
499
1257
  /**
500
1258
  * Parses string into integer number.
501
1259
  * @returns ColumnExpression
502
1260
  * @example
503
- * >>> const df = $df.data({ val: ["42"] })
504
- * >>> df.with_columns($df.col("val").str.to_integer().alias("num"))
505
- * shape: (1, 2)
506
- * ┌─────┬─────┐
507
- * │ val num │
508
- * ├─────┼─────┤
509
- * │ 42 42 │
510
- * └─────┴─────┘
1261
+ * >>> const df = $df.data({ s: ["apple", "banana", "cherry"] })
1262
+ * >>> df
1263
+ * shape: (3, 1)
1264
+ * ┌──────────┐
1265
+ * │ s
1266
+ * ├──────────┤
1267
+ * │ "apple"
1268
+ * │ "banana" │
1269
+ * │ "cherry" │
1270
+ * └──────────┘
1271
+ * >>> df.withColumns($df.col("s").str.len().str.toInteger().alias("num"))
1272
+ * shape: (3, 2)
1273
+ * ┌──────────┬─────┐
1274
+ * │ s │ num │
1275
+ * ├──────────┼─────┤
1276
+ * │ "apple" │ 5 │
1277
+ * │ "banana" │ 6 │
1278
+ * │ "cherry" │ 6 │
1279
+ * └──────────┴─────┘
511
1280
  */
512
- to_integer(): any;
1281
+ toInteger(): any;
513
1282
  /**
514
1283
  * Converts string casing to kebab-case.
515
1284
  * @returns ColumnExpression
516
1285
  * @example
517
- * >>> const df = $df.data({ text: ["helloWorld"] })
518
- * >>> df.with_columns($df.col("text").str.to_kebabcase().alias("kebab"))
519
- * shape: (1, 2)
520
- * ┌────────────┬─────────────┐
521
- * │ text kebab │
522
- * ├────────────┼─────────────┤
523
- * │ helloWorld hello-world │
524
- * └────────────┴─────────────┘
1286
+ * >>> const df = $df.data({ s: ["apple", "banana", "cherry"] })
1287
+ * >>> df
1288
+ * shape: (3, 1)
1289
+ * ┌──────────┐
1290
+ * │ s
1291
+ * ├──────────┤
1292
+ * │ "apple"
1293
+ * │ "banana" │
1294
+ * │ "cherry" │
1295
+ * └──────────┘
1296
+ * >>> df.withColumns($df.col("s").str.toKebabCase().alias("kebab"))
1297
+ * shape: (3, 2)
1298
+ * ┌─────────────┬───────────┐
1299
+ * │ s │ kebab │
1300
+ * ├─────────────┼───────────┤
1301
+ * │ "HELLO" │ hello │
1302
+ * │ "World" │ world │
1303
+ * │ "df-script" │ df-script │
1304
+ * └─────────────┴───────────┘
525
1305
  */
526
- to_kebabcase(): any;
1306
+ toKebabCase(): any;
527
1307
  /**
528
1308
  * Converts all string elements in the column to lowercase.
529
1309
  * @returns ColumnExpression
530
1310
  * @example
531
- * >>> const df = $df.data({
532
- * ... c: ["ALICE", "Bob", "charlie"]
533
- * ... })
534
- * shape: (3, 1)
535
- * ┌─────────┐
536
- * │ c │
537
- * ├─────────┤
538
- * │ ALICE
539
- * │ Bob
540
- * │ charlie │
541
- * └─────────┘
542
- *
543
- * >>> df.with_columns($df.col("c").str.to_lowercase().alias("lower_name"))
544
- * shape: (3, 2)
545
- * ┌─────────┬────────────┐
546
- * │ c lower_name
547
- * ├─────────┼────────────┤
548
- * │ ALICE alice
549
- * │ Bob │ bob │
550
- * │ charlie │ charlie │
551
- * └─────────┴────────────┘
552
- */
553
- to_lowercase(): any;
1311
+ * >>> const df = $df.data({ s: ["apple", "banana", "cherry"] })
1312
+ * >>> df
1313
+ * shape: (3, 1)
1314
+ * ┌──────────┐
1315
+ * │ s │
1316
+ * ├──────────┤
1317
+ * │ "apple" │
1318
+ * │ "banana"
1319
+ * │ "cherry"
1320
+ * └──────────┘
1321
+ * >>> df.withColumns($df.col("s").str.toLowerCase().alias("lower_name"))
1322
+ * shape: (3, 2)
1323
+ * ┌─────────────┬────────────┐
1324
+ * s │ lower_name │
1325
+ * ├─────────────┼────────────┤
1326
+ * │ "HELLO" hello
1327
+ * │ "World" │ world │
1328
+ * │ "df-script" df-script
1329
+ * └─────────────┴────────────┘
1330
+ */
1331
+ toLowerCase(): any;
554
1332
  /**
555
1333
  * Converts string casing to PascalCase.
556
1334
  * @returns ColumnExpression
557
1335
  * @example
558
- * >>> const df = $df.data({ text: ["hello_world"] })
559
- * >>> df.with_columns($df.col("text").str.to_pascalcase().alias("pascal"))
560
- * shape: (1, 2)
561
- * ┌─────────────┬────────────┐
562
- * │ text pascal │
563
- * ├─────────────┼────────────┤
564
- * │ hello_world HelloWorld │
565
- * └─────────────┴────────────┘
1336
+ * >>> const df = $df.data({ s: ["apple", "banana", "cherry"] })
1337
+ * >>> df
1338
+ * shape: (3, 1)
1339
+ * ┌──────────┐
1340
+ * │ s
1341
+ * ├──────────┤
1342
+ * │ "apple"
1343
+ * │ "banana" │
1344
+ * │ "cherry" │
1345
+ * └──────────┘
1346
+ * >>> df.withColumns($df.col("s").str.toPascalCase().alias("pascal"))
1347
+ * shape: (3, 2)
1348
+ * ┌─────────────┬───────────┐
1349
+ * │ s │ pascal │
1350
+ * ├─────────────┼───────────┤
1351
+ * │ "HELLO" │ Hello │
1352
+ * │ "World" │ World │
1353
+ * │ "df-script" │ DfScript │
1354
+ * └─────────────┴───────────┘
566
1355
  */
567
- to_pascalcase(): any;
1356
+ toPascalCase(): any;
568
1357
  /**
569
1358
  * Converts string casing to snake_case.
570
1359
  * @returns ColumnExpression
571
1360
  * @example
572
- * >>> const df = $df.data({ text: ["helloWorld"] })
573
- * >>> df.with_columns($df.col("text").str.to_snakecase().alias("snake"))
574
- * shape: (1, 2)
575
- * ┌────────────┬─────────────┐
576
- * │ text snake │
577
- * ├────────────┼─────────────┤
578
- * │ helloWorld hello_world │
579
- * └────────────┴─────────────┘
1361
+ * >>> const df = $df.data({ s: ["apple", "banana", "cherry"] })
1362
+ * >>> df
1363
+ * shape: (3, 1)
1364
+ * ┌──────────┐
1365
+ * │ s
1366
+ * ├──────────┤
1367
+ * │ "apple"
1368
+ * │ "banana" │
1369
+ * │ "cherry" │
1370
+ * └──────────┘
1371
+ * >>> df.withColumns($df.col("s").str.toSnakeCase().alias("snake"))
1372
+ * shape: (3, 2)
1373
+ * ┌─────────────┬───────────┐
1374
+ * │ s │ snake │
1375
+ * ├─────────────┼───────────┤
1376
+ * │ "HELLO" │ hello │
1377
+ * │ "World" │ world │
1378
+ * │ "df-script" │ df_script │
1379
+ * └─────────────┴───────────┘
580
1380
  */
581
- to_snakecase(): any;
1381
+ toSnakeCase(): any;
582
1382
  /**
583
1383
  * Parses string into time component representation.
584
1384
  * @returns ColumnExpression
585
1385
  * @example
586
- * >>> const df = $df.data({ t: ["10:30:00"] })
587
- * >>> df.with_columns($df.col("t").str.to_time().alias("time"))
588
- * shape: (1, 2)
589
- * ┌──────────┬──────────┐
590
- * │ t time │
591
- * ├──────────┼──────────┤
592
- * │ 10:30:00 10:30:00 │
593
- * └──────────┴──────────┘
1386
+ * >>> const df = $df.data({ s: ["apple", "banana", "cherry"] })
1387
+ * >>> df
1388
+ * shape: (3, 1)
1389
+ * ┌──────────┐
1390
+ * │ s
1391
+ * ├──────────┤
1392
+ * │ "apple"
1393
+ * │ "banana" │
1394
+ * │ "cherry" │
1395
+ * └──────────┘
1396
+ * >>> df.withColumns($df.col("s").str.toTime().alias("time"))
1397
+ * shape: (3, 2)
1398
+ * ┌──────────┬──────┐
1399
+ * │ s │ time │
1400
+ * ├──────────┼──────┤
1401
+ * │ "apple" │ null │
1402
+ * │ "banana" │ null │
1403
+ * │ "cherry" │ null │
1404
+ * └──────────┴──────┘
594
1405
  */
595
- to_time(): any;
1406
+ toTime(): any;
596
1407
  /**
597
1408
  * Converts string casing to Title Case.
598
1409
  * @returns ColumnExpression
599
1410
  * @example
600
- * >>> const df = $df.data({ text: ["hello world"] })
601
- * >>> df.with_columns($df.col("text").str.to_titlecase().alias("title"))
602
- * shape: (1, 2)
603
- * ┌─────────────┬─────────────┐
604
- * │ text title │
605
- * ├─────────────┼─────────────┤
606
- * │ hello world Hello World │
607
- * └─────────────┴─────────────┘
1411
+ * >>> const df = $df.data({ s: ["apple", "banana", "cherry"] })
1412
+ * >>> df
1413
+ * shape: (3, 1)
1414
+ * ┌──────────┐
1415
+ * │ s
1416
+ * ├──────────┤
1417
+ * │ "apple"
1418
+ * │ "banana" │
1419
+ * │ "cherry" │
1420
+ * └──────────┘
1421
+ * >>> df.withColumns($df.col("s").str.toTitleCase().alias("title"))
1422
+ * shape: (3, 2)
1423
+ * ┌─────────────┬───────────┐
1424
+ * │ s │ title │
1425
+ * ├─────────────┼───────────┤
1426
+ * │ "HELLO" │ Hello │
1427
+ * │ "World" │ World │
1428
+ * │ "df-script" │ Df Script │
1429
+ * └─────────────┴───────────┘
608
1430
  */
609
- to_titlecase(): any;
1431
+ toTitleCase(): any;
610
1432
  /**
611
1433
  * Converts all string elements in the column to uppercase.
612
1434
  * @returns ColumnExpression
613
1435
  * @example
614
- * >>> const df = $df.data({ name: ["alice"] })
615
- * >>> df.with_columns($df.col("name").str.to_uppercase().alias("upper"))
616
- * shape: (1, 2)
617
- * ┌───────┬───────┐
618
- * │ name upper │
619
- * ├───────┼───────┤
620
- * │ alice ALICE │
621
- * └───────┴───────┘
1436
+ * >>> const df = $df.data({ s: ["apple", "banana", "cherry"] })
1437
+ * >>> df
1438
+ * shape: (3, 1)
1439
+ * ┌──────────┐
1440
+ * │ s
1441
+ * ├──────────┤
1442
+ * │ "apple"
1443
+ * │ "banana" │
1444
+ * │ "cherry" │
1445
+ * └──────────┘
1446
+ * >>> df.withColumns($df.col("s").str.toUpperCase().alias("upper"))
1447
+ * shape: (3, 2)
1448
+ * ┌─────────────┬───────────┐
1449
+ * │ s │ upper │
1450
+ * ├─────────────┼───────────┤
1451
+ * │ "HELLO" │ HELLO │
1452
+ * │ "World" │ WORLD │
1453
+ * │ "df-script" │ DF-SCRIPT │
1454
+ * └─────────────┴───────────┘
622
1455
  */
623
- to_uppercase(): any;
1456
+ toUpperCase(): any;
624
1457
  /**
625
1458
  * Trims leading and trailing whitespace characters from each string element.
626
1459
  * @returns ColumnExpression
627
1460
  * @example
628
- * >>> const df = $df.data({ name: [" alice "] })
629
- * >>> df.with_columns($df.col("name").str.trim().alias("clean"))
630
- * shape: (1, 2)
631
- * ┌───────────┬───────┐
632
- * │ name clean │
633
- * ├───────────┼───────┤
634
- * │ alice │ alice
635
- * └───────────┴───────┘
1461
+ * >>> const df = $df.data({ s: ["apple", "banana", "cherry"] })
1462
+ * >>> df
1463
+ * shape: (3, 1)
1464
+ * ┌──────────┐
1465
+ * │ s
1466
+ * ├──────────┤
1467
+ * │ "apple"
1468
+ * │ "banana" │
1469
+ * │ "cherry" │
1470
+ * └──────────┘
1471
+ * >>> df.withColumns($df.col("s").str.trim().alias("clean"))
1472
+ * shape: (2, 2)
1473
+ * ┌─────────────┬───────┐
1474
+ * │ s │ clean │
1475
+ * ├─────────────┼───────┤
1476
+ * │ " hello " │ hello │
1477
+ * │ " world " │ world │
1478
+ * └─────────────┴───────┘
636
1479
  */
637
1480
  trim(): any;
638
1481
  /**
639
1482
  * Trims trailing whitespace characters from each string element.
640
1483
  * @returns ColumnExpression
641
1484
  * @example
642
- * >>> const df = $df.data({ name: ["alice "] })
643
- * >>> df.with_columns($df.col("name").str.trim_end().alias("clean"))
644
- * shape: (1, 2)
645
- * ┌─────────┬───────┐
646
- * │ name clean │
647
- * ├─────────┼───────┤
648
- * │ alice alice │
649
- * └─────────┴───────┘
1485
+ * >>> const df = $df.data({ s: ["apple", "banana", "cherry"] })
1486
+ * >>> df
1487
+ * shape: (3, 1)
1488
+ * ┌──────────┐
1489
+ * │ s
1490
+ * ├──────────┤
1491
+ * │ "apple"
1492
+ * │ "banana" │
1493
+ * │ "cherry" │
1494
+ * └──────────┘
1495
+ * >>> df.withColumns($df.col("s").str.trimEnd().alias("clean"))
1496
+ * shape: (2, 2)
1497
+ * ┌─────────────┬──────────┐
1498
+ * │ s │ clean │
1499
+ * ├─────────────┼──────────┤
1500
+ * │ " hello " │ " hello" │
1501
+ * │ " world " │ " world" │
1502
+ * └─────────────┴──────────┘
650
1503
  */
651
- trim_end(): any;
1504
+ trimEnd(): any;
652
1505
  /**
653
1506
  * Trims leading whitespace characters from each string element.
654
1507
  * @returns ColumnExpression
655
1508
  * @example
656
- * >>> const df = $df.data({ name: [" alice"] })
657
- * >>> df.with_columns($df.col("name").str.trim_start().alias("clean"))
658
- * shape: (1, 2)
659
- * ┌─────────┬───────┐
660
- * │ name clean │
661
- * ├─────────┼───────┤
662
- * │ alice alice │
663
- * └─────────┴───────┘
1509
+ * >>> const df = $df.data({ s: ["apple", "banana", "cherry"] })
1510
+ * >>> df
1511
+ * shape: (3, 1)
1512
+ * ┌──────────┐
1513
+ * │ s
1514
+ * ├──────────┤
1515
+ * │ "apple"
1516
+ * │ "banana" │
1517
+ * │ "cherry" │
1518
+ * └──────────┘
1519
+ * >>> df.withColumns($df.col("s").str.trimStart().alias("clean"))
1520
+ * shape: (2, 2)
1521
+ * ┌─────────────┬──────────┐
1522
+ * │ s │ clean │
1523
+ * ├─────────────┼──────────┤
1524
+ * │ " hello " │ "hello "│
1525
+ * │ " world " │ "world "│
1526
+ * └─────────────┴──────────┘
664
1527
  */
665
- trim_start(): any;
1528
+ trimStart(): any;
666
1529
  /**
667
1530
  * Converts string to uppercase.
668
1531
  * @returns ColumnExpression
669
1532
  * @example
670
- * >>> const df = $df.data({ text: ["alice"] })
671
- * >>> df.with_columns($df.col("text").str.upper().alias("upper"))
672
- * shape: (1, 2)
673
- * ┌───────┬───────┐
674
- * │ text upper │
675
- * ├───────┼───────┤
676
- * │ alice ALICE │
677
- * └───────┴───────┘
1533
+ * >>> const df = $df.data({ s: ["apple", "banana", "cherry"] })
1534
+ * >>> df
1535
+ * shape: (3, 1)
1536
+ * ┌──────────┐
1537
+ * │ s
1538
+ * ├──────────┤
1539
+ * │ "apple"
1540
+ * │ "banana" │
1541
+ * │ "cherry" │
1542
+ * └──────────┘
1543
+ * >>> df.withColumns($df.col("s").str.upper().alias("upper"))
1544
+ * shape: (3, 2)
1545
+ * ┌─────────────┬───────────┐
1546
+ * │ s │ upper │
1547
+ * ├─────────────┼───────────┤
1548
+ * │ "HELLO" │ HELLO │
1549
+ * │ "World" │ WORLD │
1550
+ * │ "df-script" │ DF-SCRIPT │
1551
+ * └─────────────┴───────────┘
678
1552
  */
679
1553
  upper(): any;
680
1554
  /**
@@ -682,14 +1556,25 @@ export declare class StringExprNamespace {
682
1556
  * @param width Minimum resulting string width.
683
1557
  * @returns ColumnExpression
684
1558
  * @example
685
- * >>> const df = $df.data({ num: ["42"] })
686
- * >>> df.with_columns($df.col("num").str.zfill(5).alias("padded"))
687
- * shape: (1, 2)
688
- * ┌─────┬────────┐
689
- * │ num padded │
690
- * ├─────┼────────┤
691
- * │ 42 00042 │
692
- * └─────┴────────┘
1559
+ * >>> const df = $df.data({ s: ["apple", "banana", "cherry"] })
1560
+ * >>> df
1561
+ * shape: (3, 1)
1562
+ * ┌──────────┐
1563
+ * │ s
1564
+ * ├──────────┤
1565
+ * │ "apple"
1566
+ * │ "banana" │
1567
+ * │ "cherry" │
1568
+ * └──────────┘
1569
+ * >>> df.withColumns($df.col("s").str.zfill(8).alias("padded"))
1570
+ * shape: (3, 2)
1571
+ * ┌──────────┬──────────┐
1572
+ * │ s │ padded │
1573
+ * ├──────────┼──────────┤
1574
+ * │ "apple" │ 000apple │
1575
+ * │ "banana" │ 00banana │
1576
+ * │ "cherry" │ 00cherry │
1577
+ * └──────────┴──────────┘
693
1578
  */
694
1579
  zfill(width: number): any;
695
1580
  }
@@ -701,7 +1586,25 @@ export declare class StringExpr extends ExprBase {
701
1586
  * @syntax $df.col(<column_name>).str
702
1587
  * @returns StringExprNamespace
703
1588
  * @example
704
- * >>> df.select($df.col("a").str.len())
1589
+ * >>> const df = $df.data({ s: ["apple", "banana", "cherry"] })
1590
+ * >>> df
1591
+ * shape: (3, 1)
1592
+ * ┌──────────┐
1593
+ * │ s │
1594
+ * ├──────────┤
1595
+ * │ "apple" │
1596
+ * │ "banana" │
1597
+ * │ "cherry" │
1598
+ * └──────────┘
1599
+ * >>> df.select($df.col("s").str.len())
1600
+ * shape: (3, 1)
1601
+ * ┌─────┐
1602
+ * │ len │
1603
+ * ├─────┤
1604
+ * │ 5 │
1605
+ * │ 6 │
1606
+ * │ 6 │
1607
+ * └─────┘
705
1608
  */
706
1609
  get str(): StringExprNamespace;
707
1610
  }