df-script 1.9.0 → 2.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (59) hide show
  1. package/README.md +148 -235
  2. package/dist/api.d.ts +41 -36
  3. package/dist/columnExpressions/ColumnExpr.d.ts +5 -8
  4. package/dist/columnExpressions/functions/all.d.ts +13 -13
  5. package/dist/columnExpressions/functions/coalesce.d.ts +2 -2
  6. package/dist/columnExpressions/functions/duration.d.ts +16 -21
  7. package/dist/columnExpressions/functions/element.d.ts +10 -10
  8. package/dist/columnExpressions/functions/exclude.d.ts +14 -14
  9. package/dist/columnExpressions/functions/implode.d.ts +7 -7
  10. package/dist/columnExpressions/functions/lit.d.ts +9 -9
  11. package/dist/columnExpressions/functions/seqRange.d.ts +69 -0
  12. package/dist/columnExpressions/functions/struct.d.ts +6 -6
  13. package/dist/columnExpressions/functions/when.d.ts +25 -28
  14. package/dist/columnExpressions/index.d.ts +3 -7
  15. package/dist/columnExpressions/mixins/AggregationExpr.d.ts +550 -221
  16. package/dist/columnExpressions/mixins/ArithmeticExpr.d.ts +701 -327
  17. package/dist/columnExpressions/mixins/ArrayExpr.d.ts +508 -212
  18. package/dist/columnExpressions/mixins/ComparisonExpr.d.ts +398 -201
  19. package/dist/columnExpressions/mixins/LogicalExpr.d.ts +59 -29
  20. package/dist/columnExpressions/mixins/ManipulationExpr.d.ts +23 -9
  21. package/dist/columnExpressions/mixins/StandardExpr.d.ts +3234 -0
  22. package/dist/columnExpressions/mixins/StringExpr.d.ts +1163 -524
  23. package/dist/columnExpressions/mixins/StructExpr.d.ts +67 -25
  24. package/dist/columnExpressions/mixins/TemporalExpr.d.ts +518 -212
  25. package/dist/columnExpressions/mixins/WindowExpr.d.ts +270 -102
  26. package/dist/columnExpressions/typeInference.d.ts +3 -3
  27. package/dist/columnExpressions/types.d.ts +5 -0
  28. package/dist/columnExpressions/utils.d.ts +7 -0
  29. package/dist/constants.d.ts +11 -2
  30. package/dist/dataframe/dataframe.d.ts +755 -592
  31. package/dist/dataframe/grouped/grouped.d.ts +24 -6
  32. package/dist/dataframe/grouped.d.ts +70 -0
  33. package/dist/dataframe/index.d.ts +1 -1
  34. package/dist/dataframe/lazy.d.ts +37 -0
  35. package/dist/dataframe/types.d.ts +46 -22
  36. package/dist/dataframe/utils.d.ts +10 -4
  37. package/dist/datatypes/index.d.ts +11 -4
  38. package/dist/expressions.js +1 -0
  39. package/dist/expressions.mjs +1 -0
  40. package/dist/functions/concat.d.ts +68 -16
  41. package/dist/functions/index.d.ts +2 -2
  42. package/dist/functions/readCsv.d.ts +35 -0
  43. package/dist/functions/readJson.d.ts +33 -0
  44. package/dist/index.js +5 -6
  45. package/dist/index.mjs +5 -6
  46. package/dist/types.d.ts +42 -9
  47. package/dist/utils/array.d.ts +17 -14
  48. package/dist/utils/csv.d.ts +4 -1
  49. package/dist/utils/date.d.ts +3 -19
  50. package/dist/utils/duration.d.ts +7 -5
  51. package/dist/utils/json.d.ts +5 -3
  52. package/dist/utils/object.d.ts +0 -18
  53. package/dist/utils/string.d.ts +5 -0
  54. package/dist/utils.js +4 -0
  55. package/dist/utils.mjs +4 -0
  56. package/package.json +29 -8
  57. package/dist/assets/index-DBhGK6Tp.css +0 -1
  58. package/dist/assets/index-DEJEV_tU.js +0 -195
  59. package/dist/index.html +0 -17
@@ -17,14 +17,25 @@ export declare class StringExprNamespace {
17
17
  * @param other The string value or column expression to concatenate.
18
18
  * @returns ColumnExpression
19
19
  * @example
20
- * >>> const df = $df.data({ first: ["John"], last: ["Doe"] })
21
- * >>> df.with_columns($df.col("first").str.concat(" ").str.concat($df.col("last")).alias("full"))
22
- * shape: (1, 3)
23
- * ┌───────┬──────┬──────────┐
24
- * │ first last │ full │
25
- * ├───────┼──────┼──────────┤
26
- * │ John Doe │ John Doe │
27
- * └───────┴──────┴──────────┘
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
+ * └──────────┴───────────┘
28
39
  */
29
40
  concat(other: string | IExpr): any;
30
41
  /**
@@ -32,8 +43,17 @@ export declare class StringExprNamespace {
32
43
  * @param pattern The search substring or regular expression pattern.
33
44
  * @returns ColumnExpression
34
45
  * @example
35
- * >>> const df = $df.data({ email: ["user@example.com", "admin@test.org"] })
36
- * >>> 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"))
37
57
  * shape: (2, 2)
38
58
  * ┌──────────────────┬────────────┐
39
59
  * │ email │ is_example │
@@ -48,8 +68,17 @@ export declare class StringExprNamespace {
48
68
  * @param patterns Array of substring or regular expression search patterns.
49
69
  * @returns ColumnExpression
50
70
  * @example
51
- * >>> const df = $df.data({ email: ["user@example.com", "admin@test.org"] })
52
- * >>> df.with_columns($df.col("email").str.contains_any(["@example.com", "@test.org"]).alias("is_target"))
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"))
53
82
  * shape: (2, 2)
54
83
  * ┌──────────────────┬───────────┐
55
84
  * │ email │ is_target │
@@ -58,126 +87,212 @@ export declare class StringExprNamespace {
58
87
  * │ admin@test.org │ true │
59
88
  * └──────────────────┴───────────┘
60
89
  */
61
- contains_any(patterns: (string | RegExp)[]): any;
90
+ containsAny(patterns: (string | RegExp)[]): any;
62
91
  /**
63
92
  * Counts occurrences of a substring or regular expression match in each string element.
64
93
  * @param pattern Search substring or regular expression.
65
94
  * @returns ColumnExpression
66
95
  * @example
67
- * >>> const df = $df.data({ code: ["banana", "apple"] })
68
- * >>> df.with_columns($df.col("code").str.count_matches("a").alias("a_count"))
69
- * shape: (2, 2)
70
- * ┌────────┬─────────┐
71
- * │ code a_count │
72
- * ├────────┼─────────┤
73
- * │ banana 3 │
74
- * │ apple │ 1
75
- * └────────┴─────────┘
76
- */
77
- count_matches(pattern: string | RegExp | any, options?: {
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?: {
78
117
  literal?: boolean;
79
118
  } | boolean): any;
80
119
  /**
81
120
  * Escapes special regular expression characters in string elements.
82
121
  * @returns ColumnExpression
83
122
  * @example
84
- * >>> const df = $df.data({ pat: ["a.b", "c$d"] })
85
- * >>> df.with_columns($df.col("pat").str.escape_regex().alias("escaped"))
86
- * shape: (2, 2)
87
- * ┌───────┬─────────┐
88
- * │ pat escaped │
89
- * ├───────┼─────────┤
90
- * │ a.b a\.b │
91
- * │ c$d │ c\$d
92
- * └───────┴─────────┘
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
+ * └──────────┴─────────┘
93
142
  */
94
- escape_regex(options?: EscapeRegexOptions): any;
143
+ escapeRegex(options?: EscapeRegexOptions): any;
95
144
  /**
96
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.
97
148
  * @param options Object containing encoding ("hex" | "base64") and optional strict flag
98
149
  * @returns ColumnExpression
99
150
  * @example
100
- * >>> const df = $df.data({ encoded: ["68656c6c6f"] })
101
- * >>> df.with_columns($df.col("encoded").str.decode({ encoding: "hex" }).alias("decoded"))
102
- * shape: (1, 2)
103
- * ┌────────────┬─────────┐
104
- * │ encoded decoded │
105
- * ├────────────┼─────────┤
106
- * │ 68656c6c6f hello │
107
- * └────────────┴─────────┘
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
+ * └──────────┴─────────┘
108
170
  */
109
171
  decode(options: StringDecodeOptions): any;
110
172
  /**
111
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.
112
176
  * @param options Object containing encoding ("hex" | "base64")
113
177
  * @returns ColumnExpression
114
178
  * @example
115
- * >>> const df = $df.data({ text: ["hello"] })
116
- * >>> df.with_columns($df.col("text").str.encode({ encoding: "hex" }).alias("encoded"))
117
- * shape: (1, 2)
118
- * ┌───────┬────────────┐
119
- * │ text encoded │
120
- * ├───────┼────────────┤
121
- * │ hello 68656c6c6f │
122
- * └───────┴────────────┘
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
+ * └──────────┴────────────────┘
123
198
  */
124
199
  encode(options: StringEncodeOptions): any;
125
200
  /**
126
201
  * Decodes Uniform Resource Identifier (URI) components.
127
202
  * @returns ColumnExpression
128
203
  * @example
129
- * >>> const df = $df.data({ url: ["hello%20world"] })
130
- * >>> df.with_columns($df.col("url").str.decode_uri_component().alias("decoded"))
131
- * shape: (1, 2)
132
- * ┌───────────────┬─────────────┐
133
- * │ url decoded │
134
- * ├───────────────┼─────────────┤
135
- * │ hello%20world hello world │
136
- * └───────────────┴─────────────┘
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
+ * └─────────────┴─────────────┘
137
222
  */
138
- decode_uri_component(): any;
223
+ decodeUriComponent(): any;
139
224
  /**
140
225
  * Encodes Uniform Resource Identifier (URI) components.
141
226
  * @returns ColumnExpression
142
227
  * @example
143
- * >>> const df = $df.data({ term: ["hello world"] })
144
- * >>> df.with_columns($df.col("term").str.encode_uri_component().alias("encoded"))
145
- * shape: (1, 2)
146
- * ┌─────────────┬───────────────┐
147
- * │ term encoded │
148
- * ├─────────────┼───────────────┤
149
- * │ hello world hello%20world │
150
- * └─────────────┴───────────────┘
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
+ * └─────────────┴───────────────────┘
151
246
  */
152
- encode_uri_component(): any;
247
+ encodeUriComponent(): any;
153
248
  /**
154
249
  * Checks if string ends with a suffix.
155
250
  * @param suffix The suffix substring.
156
251
  * @returns ColumnExpression
157
252
  * @example
158
- * >>> const df = $df.data({ email: ["user@org.org", "admin@com.com"] })
159
- * >>> 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"))
160
264
  * shape: (2, 2)
161
- * ┌──────────────┬────────┐
162
- * │ email │ is_org │
163
- * ├──────────────┼────────┤
164
- * │ user@org.orgtrue
165
- * │ admin@com.comfalse
166
- * └──────────────┴────────┘
265
+ * ┌──────────────────┬────────┐
266
+ * │ email │ is_org │
267
+ * ├──────────────────┼────────┤
268
+ * │ user@example.comfalse
269
+ * │ admin@test.org true
270
+ * └──────────────────┴────────┘
167
271
  */
168
- ends_with(suffix: string): any;
272
+ endsWith(suffix: string): any;
169
273
  /**
170
274
  * Splits strings into lists of single characters.
171
275
  * @returns ColumnExpression
172
276
  * @example
173
- * >>> const df = $df.data({ word: ["cat"] })
174
- * >>> df.with_columns($df.col("word").str.explode().alias("chars"))
175
- * shape: (1, 2)
176
- * ┌──────┬─────────────────┐
177
- * │ word chars │
178
- * ├──────┼─────────────────┤
179
- * │ cat │ ["c", "a", "t"]
180
- * └──────┴─────────────────┘
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
+ * └──────────┴─────────────────────────────────────┘
181
296
  */
182
297
  explode(): any;
183
298
  /**
@@ -186,14 +301,24 @@ export declare class StringExprNamespace {
186
301
  * @param options Options object. Use `groupIndex` to select the group (default 1).
187
302
  * @returns ColumnExpression
188
303
  * @example
189
- * >>> const df = $df.data({ info: ["id:123"] })
190
- * >>> df.with_columns($df.col("info").str.extract(/id:(\d+)/).alias("id"))
191
- * shape: (1, 2)
192
- * ┌────────┬─────┐
193
- * │ info id │
194
- * ├────────┼─────┤
195
- * │ id:123 123 │
196
- * └────────┴─────┘
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
+ * └──────────────────┴─────────┘
197
322
  */
198
323
  extract(pattern: RegExp | string, options?: ExtractRegexEngineOptions): any;
199
324
  /**
@@ -202,47 +327,79 @@ export declare class StringExprNamespace {
202
327
  * @param options Options object. Use `groupIndex` to select the group (default 0).
203
328
  * @returns ColumnExpression
204
329
  * @example
205
- * >>> const df = $df.data({ text: ["foo 123 bar 456"] })
206
- * >>> df.with_columns($df.col("text").str.extract_all(/\d+/).alias("nums"))
207
- * shape: (1, 2)
208
- * ┌─────────────────┬──────────────┐
209
- * │ text nums │
210
- * ├─────────────────┼──────────────┤
211
- * │ foo 123 bar 456 [123, 456] │
212
- * └─────────────────┴──────────────┘
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
+ * └──────────┴─────────────────┘
213
349
  */
214
- extract_all(pattern: string | RegExp, options?: ExtractRegexEngineOptions): any;
350
+ extractAll(pattern: string | RegExp, options?: ExtractRegexEngineOptions): any;
215
351
  /**
216
352
  * Extracts all captured groups from the first regex match into a structured object (struct).
217
353
  * @param pattern Search pattern containing capture groups.
218
354
  * @returns ColumnExpression
219
355
  * @example
220
- * >>> const df = $df.data({ info: ["id:123-name:alice"] })
221
- * >>> df.with_columns($df.col("info").str.extract_groups(/(?<id>\d+)-(?<name>\w+)/).alias("parsed"))
222
- * shape: (1, 2)
223
- * ┌────────────────────┬─────────────────────────────┐
224
- * │ info parsed │
225
- * ├────────────────────┼─────────────────────────────┤
226
- * │ id:123-name:alice │ { id: "123", name: "alice" }
227
- * └────────────────────┴─────────────────────────────┘
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
+ * └──────────────────┴────────────────────────────────────┘
228
374
  */
229
- extract_groups(pattern: string | RegExp, options?: ExtractManyOptions): any;
375
+ extractGroups(pattern: string | RegExp, options?: ExtractManyOptions): any;
230
376
  /**
231
377
  * Extracts the first regex match for each pattern in a list of patterns.
232
378
  * @param patterns Array of regular expression patterns or strings.
233
379
  * @param options Named options object ({ asciiCaseInsensitive, overlapping }).
234
380
  * @returns ColumnExpression
235
381
  * @example
236
- * >>> const df = $df.data({ text: ["user_123_PROD"] })
237
- * >>> df.with_columns($df.col("text").str.extract_many([/user_\d+/, /prod/], { asciiCaseInsensitive: true }).alias("extracted"))
238
- * shape: (1, 2)
239
- * ┌───────────────┬──────────────────────────┐
240
- * │ text extracted │
241
- * ├───────────────┼──────────────────────────┤
242
- * │ user_123_PROD │ ["user_123", "PROD"]
243
- * └───────────────┴──────────────────────────┘
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
+ * └──────────┴─────────────┘
244
401
  */
245
- extract_many(patterns: (string | RegExp)[], options?: ExtractManyOptions): any;
402
+ extractMany(patterns: (string | RegExp)[], options?: ExtractManyOptions): any;
246
403
  /**
247
404
  * Return the byte offset of the first substring matching a pattern.
248
405
  * Returns null if pattern is not found.
@@ -250,14 +407,25 @@ export declare class StringExprNamespace {
250
407
  * @param options Configuration options ({ literal, asciiCaseInsensitive }).
251
408
  * @returns ColumnExpression
252
409
  * @example
253
- * >>> const df = $df.data({ text: ["user_123_PROD"] })
254
- * >>> df.with_columns($df.col("text").str.find(/\d+/).alias("pos"))
255
- * shape: (1, 2)
256
- * ┌───────────────┬─────┐
257
- * │ text pos │
258
- * ├───────────────┼─────┤
259
- * │ user_123_PROD 5 │
260
- * └───────────────┴─────┘
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
+ * └──────────┴──────┘
261
429
  */
262
430
  find(value: string | RegExp, options?: FindOptions): any;
263
431
  /**
@@ -266,30 +434,51 @@ export declare class StringExprNamespace {
266
434
  * @param options Configuration options ({ literal, asciiCaseInsensitive, overlapping, leftmost }).
267
435
  * @returns ColumnExpression
268
436
  * @example
269
- * >>> const df = $df.data({ text: ["user_123_PROD"] })
270
- * >>> df.with_columns($df.col("text").str.find_many([/user_\d+/, /PROD/]).alias("positions"))
271
- * shape: (1, 2)
272
- * ┌───────────────┬───────────┐
273
- * │ text positions │
274
- * ├───────────────┼───────────┤
275
- * │ user_123_PROD [0, 9] │
276
- * └───────────────┴───────────┘
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
+ * └──────────┴───────────┘
277
456
  */
278
- find_many(patterns: (string | RegExp)[], options?: FindManyOptions): any;
457
+ findMany(patterns: (string | RegExp)[], options?: FindManyOptions): any;
279
458
  /**
280
459
  * Extracts the first n characters of each string element.
281
460
  * @param n Number of characters to extract from the start of the string (default 1).
282
461
  * @returns ColumnExpression
283
462
  * @example
284
- * >>> const df = $df.data({ name: ["polars", "javascript"] })
285
- * >>> df.with_columns($df.col("name").str.head(3).alias("prefix"))
286
- * shape: (2, 2)
287
- * ┌────────────┬────────┐
288
- * │ name prefix │
289
- * ├────────────┼────────┤
290
- * │ polars pol │
291
- * │ javascript jav │
292
- * └────────────┴────────┘
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
+ * └──────────┴────────┘
293
482
  */
294
483
  head(n?: number): any;
295
484
  /**
@@ -299,15 +488,23 @@ export declare class StringExprNamespace {
299
488
  * @param options Formatting configuration options (`JoinArrayOptions`).
300
489
  * @returns ColumnExpression
301
490
  * @example
302
- * >>> const df = $df.data({ tags: [["a", "b", "c"], ["x", "y"]] })
303
- * >>> df.with_columns($df.col("tags").str.join("-").alias("joined"))
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"))
304
501
  * shape: (2, 2)
305
- * ┌─────────────────┬──────────┐
306
- * │ tags │ joined
307
- * ├─────────────────┼──────────┤
308
- * │ ["a", "b", "c"] │ a-b-c
309
- * │ ["x", "y"] │ x-y
310
- * └─────────────────┴──────────┘
502
+ * ┌────────────┬────────┐
503
+ * │ a │ joined
504
+ * ├────────────┼────────┤
505
+ * │ ["a", "b"] │ a-b │
506
+ * │ ["c"] │ c
507
+ * └────────────┴────────┘
311
508
  */
312
509
  join(delimiter?: string, options?: JoinArrayOptions): any;
313
510
  /**
@@ -316,87 +513,149 @@ export declare class StringExprNamespace {
316
513
  * @param options Configuration options for parsing (`SafeJsonParseOptions`).
317
514
  * @returns ColumnExpression
318
515
  * @example
319
- * >>> const df = $df.data({ json_str: ['{"a": 1}', '{"b": 2}'] })
320
- * >>> df.with_columns($df.col("json_str").str.json_decode().alias("parsed"))
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"))
321
527
  * shape: (2, 2)
322
- * ┌────────────┬───────────┐
323
- * │ json_str │ parsed
324
- * ├────────────┼───────────┤
325
- * │ {"a": 1} { a: 1 }
326
- * │ {"b": 2} { b: 2 }
327
- * └────────────┴───────────┘
528
+ * ┌─────────────┬─────────┐
529
+ * │ s │ parsed
530
+ * ├─────────────┼─────────┤
531
+ * │ " hello " │ "hello"
532
+ * │ " world " │ "world"
533
+ * └─────────────┴─────────┘
328
534
  */
329
- json_decode(options?: SafeJsonParseOptions): any;
535
+ jsonDecode(options?: SafeJsonParseOptions): any;
330
536
  /**
331
537
  * Extracts fields or array elements from JSON strings using JSONPath syntax.
332
538
  * @param jsonPath The JSONPath expression (e.g. `"$.store.book[0].title"` or `"$.a.b"`).
333
539
  * @returns ColumnExpression
334
540
  * @example
335
- * >>> const df = $df.data({ json_str: ['{"a": {"b": 10}}', '{"a": {"b": 20}}'] })
336
- * >>> df.with_columns($df.col("json_str").str.json_path_match("$.a.b").alias("val"))
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"))
337
552
  * shape: (2, 2)
338
- * ┌────────────────────┬─────┐
339
- * │ json_str │ val
340
- * ├────────────────────┼─────┤
341
- * │ {"a": {"b": 10}} 10 │
342
- * │ {"a": {"b": 20}} 20 │
343
- * └────────────────────┴─────┘
553
+ * ┌─────────────┬─────────┐
554
+ * │ s │ val
555
+ * ├─────────────┼─────────┤
556
+ * │ " hello " "hello" │
557
+ * │ " world " "world" │
558
+ * └─────────────┴─────────┘
344
559
  */
345
- json_path_match(jsonPath: string): any;
560
+ jsonPathMatch(jsonPath: string): any;
346
561
  /**
347
- * Returns string length in UTF-16 code units. Alias for len_chars.
562
+ * Returns string length in UTF-16 code units. Alias for lenChars.
348
563
  * @returns ColumnExpression
349
564
  * @example
350
- * >>> const df = $df.data({ str: ["hello"] })
351
- * >>> df.with_columns($df.col("str").str.len().alias("length"))
352
- * shape: (1, 2)
353
- * ┌───────┬────────┐
354
- * │ str length │
355
- * ├───────┼────────┤
356
- * │ hello 5 │
357
- * └───────┴────────┘
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
+ * └──────────┴────────┘
358
584
  */
359
585
  len(): any;
360
586
  /**
361
587
  * Returns string length in UTF-8 encoded bytes.
362
588
  * @returns ColumnExpression
363
589
  * @example
364
- * >>> const df = $df.data({ str: ["hello"] })
365
- * >>> df.with_columns($df.col("str").str.len_bytes().alias("bytes"))
366
- * shape: (1, 2)
367
- * ┌───────┬───────┐
368
- * │ str bytes │
369
- * ├───────┼───────┤
370
- * │ hello 5 │
371
- * └───────┴───────┘
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
+ * └──────────┴───────┘
372
609
  */
373
- len_bytes(): any;
610
+ lenBytes(): any;
374
611
  /**
375
612
  * Returns string length in character count.
376
613
  * @returns ColumnExpression
377
614
  * @example
378
- * >>> const df = $df.data({ text: ["hello"] })
379
- * >>> df.with_columns($df.col("text").str.len_chars().alias("length"))
380
- * shape: (1, 2)
381
- * ┌───────┬────────┐
382
- * │ text length │
383
- * ├───────┼────────┤
384
- * │ hello 5 │
385
- * └───────┴────────┘
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
+ * └──────────┴────────┘
386
634
  */
387
- len_chars(): any;
635
+ lenChars(): any;
388
636
  /**
389
637
  * Converts strings to lowercase.
390
638
  * @returns ColumnExpression
391
639
  * @example
392
- * >>> const df = $df.data({ str: ["HELLO"] })
393
- * >>> df.with_columns($df.col("str").str.lower().alias("lowered"))
394
- * shape: (1, 2)
395
- * ┌───────┬─────────┐
396
- * │ str lowered │
397
- * ├───────┼─────────┤
398
- * │ HELLO hello │
399
- * └───────┴─────────┘
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
+ * └─────────────┴───────────┘
400
659
  */
401
660
  lower(): any;
402
661
  /**
@@ -405,14 +664,25 @@ export declare class StringExprNamespace {
405
664
  * @param fill Character sequence used for padding.
406
665
  * @returns ColumnExpression
407
666
  * @example
408
- * >>> const df = $df.data({ num: ["5"] })
409
- * >>> df.with_columns($df.col("num").str.lpad(3, "0").alias("padded"))
410
- * shape: (1, 2)
411
- * ┌─────┬────────┐
412
- * │ num padded │
413
- * ├─────┼────────┤
414
- * │ 5 005 │
415
- * └─────┴────────┘
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
+ * └──────────┴──────────┘
416
686
  */
417
687
  lpad(width: number, fill?: string): any;
418
688
  /**
@@ -421,14 +691,25 @@ export declare class StringExprNamespace {
421
691
  * @returns ColumnExpression
422
692
  * @throws InvalidArgumentError If an invalid normalization form is provided.
423
693
  * @example
424
- * >>> const df = $df.data({ str: ["e\u0301"] })
425
- * >>> df.with_columns($df.col("str").str.normalize("NFC").alias("normalized"))
426
- * shape: (1, 2)
427
- * ┌───────┬────────────┐
428
- * │ str normalized │
429
- * ├───────┼────────────┤
430
- * │ é │
431
- * └───────┴────────────┘
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
+ * └─────────────┴────────────┘
432
713
  */
433
714
  normalize(form?: Parameters<typeof String.prototype.normalize>[0]): any;
434
715
  /**
@@ -437,32 +718,54 @@ export declare class StringExprNamespace {
437
718
  * @param fill Character sequence used for padding.
438
719
  * @returns ColumnExpression
439
720
  * @example
440
- * >>> const df = $df.data({ text: ["a"] })
441
- * >>> df.with_columns($df.col("text").str.pad_end(3, "-").alias("padded"))
442
- * shape: (1, 2)
443
- * ┌──────┬────────┐
444
- * │ text padded │
445
- * ├──────┼────────┤
446
- * │ a a-- │
447
- * └──────┴────────┘
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
+ * └──────────┴──────────┘
448
740
  */
449
- pad_end(width: number, fill?: string): any;
741
+ padEnd(width: number, fill?: string): any;
450
742
  /**
451
743
  * Pads start of strings to specified width. Alias for lpad.
452
744
  * @param width Target string length.
453
745
  * @param fill Character sequence used for padding.
454
746
  * @returns ColumnExpression
455
747
  * @example
456
- * >>> const df = $df.data({ num: ["5"] })
457
- * >>> df.with_columns($df.col("num").str.pad_start(3, "0").alias("padded"))
458
- * shape: (1, 2)
459
- * ┌─────┬────────┐
460
- * │ num padded │
461
- * ├─────┼────────┤
462
- * │ 5 005 │
463
- * └─────┴────────┘
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
+ * └──────────┴──────────┘
464
767
  */
465
- pad_start(width: number, fill?: string): any;
768
+ padStart(width: number, fill?: string): any;
466
769
  /**
467
770
  * Replaces the first occurrence matching a string pattern.
468
771
  * @param pattern The search pattern string or regular expression.
@@ -470,14 +773,24 @@ export declare class StringExprNamespace {
470
773
  * @param options Optional replace options (literal, asciiCaseInsensitive, n).
471
774
  * @returns ColumnExpression
472
775
  * @example
473
- * >>> const df = $df.data({ email: ["old.com"] })
474
- * >>> df.with_columns($df.col("email").str.replace("old.com", "new.com").alias("updated"))
475
- * shape: (1, 2)
476
- * ┌─────────┬─────────┐
477
- * │ email updated │
478
- * ├─────────┼─────────┤
479
- * │ old.com new.com │
480
- * └─────────┴─────────┘
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
+ * └──────────────────┴───────────────┘
481
794
  */
482
795
  replace(pattern: string | RegExp, replacement: string | ((match: string, ...args: any[]) => string), options?: ReplaceOptions): any;
483
796
  /**
@@ -487,46 +800,79 @@ export declare class StringExprNamespace {
487
800
  * @param options Optional replace options (literal, asciiCaseInsensitive).
488
801
  * @returns ColumnExpression
489
802
  * @example
490
- * >>> const df = $df.data({ text: ["foo bar foo"] })
491
- * >>> df.with_columns($df.col("text").str.replace_all("foo", "baz").alias("replaced"))
492
- * shape: (1, 2)
493
- * ┌─────────────┬─────────────┐
494
- * │ text replaced │
495
- * ├─────────────┼─────────────┤
496
- * │ foo bar foo baz bar baz │
497
- * └─────────────┴─────────────┘
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
+ * └──────────┴──────────┘
498
822
  */
499
- replace_all(pattern: string | RegExp, replacement: string | ((match: string, ...args: any[]) => string), options?: Omit<ReplaceOptions, "n">): any;
823
+ replaceAll(pattern: string | RegExp, replacement: string | ((match: string, ...args: any[]) => string), options?: Omit<ReplaceOptions, "n">): any;
500
824
  /**
501
825
  * Replaces multiple string patterns simultaneously or sequentially with their respective replacements.
502
- * Matches Polars `.str.replace_many()` behavior, accepting pattern/replacement arrays or a pattern-to-replacement map dictionary.
826
+ * Matches Polars `.str.replaceMany()` behavior, accepting pattern/replacement arrays or a pattern-to-replacement map dictionary.
503
827
  * @param patterns Array of patterns or an object mapping target patterns to replacements.
504
828
  * @param replacements Array of replacement strings/callbacks (when patterns is an array).
505
829
  * @param options Configuration options ({ literal, asciiCaseInsensitive, mode }).
506
830
  * @returns ColumnExpression
507
831
  * @example
508
- * >>> const df = $df.data({ text: ["foo bar baz"] })
509
- * >>> df.with_columns($df.col("text").str.replace_many(["foo", "bar"], ["1", "2"]).alias("res"))
510
- * shape: (1, 2)
511
- * ┌─────────────┬─────────┐
512
- * │ text res │
513
- * ├─────────────┼─────────┤
514
- * │ foo bar baz 1 2 baz │
515
- * └─────────────┴─────────┘
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
+ * └──────────┴────────┘
516
851
  */
517
- replace_many(patterns: (string | RegExp)[] | Record<string, string>, replacements?: (string | ((match: string, ...args: any[]) => string))[], options?: ReplaceManyOptions): any;
852
+ replaceMany(patterns: (string | RegExp)[] | Record<string, string>, replacements?: (string | ((match: string, ...args: any[]) => string))[], options?: ReplaceManyOptions): any;
518
853
  /**
519
854
  * Reverses characters in each string element.
520
855
  * @returns ColumnExpression
521
856
  * @example
522
- * >>> const df = $df.data({ str: ["abc"] })
523
- * >>> df.with_columns($df.col("str").str.reverse().alias("rev"))
524
- * shape: (1, 2)
525
- * ┌─────┬─────┐
526
- * │ str rev │
527
- * ├─────┼─────┤
528
- * │ abc cba │
529
- * └─────┴─────┘
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
+ * └──────────┴────────┘
530
876
  */
531
877
  reverse(): any;
532
878
  /**
@@ -535,14 +881,25 @@ export declare class StringExprNamespace {
535
881
  * @param fill Character sequence used for padding.
536
882
  * @returns ColumnExpression
537
883
  * @example
538
- * >>> const df = $df.data({ text: ["a"] })
539
- * >>> df.with_columns($df.col("text").str.rpad(3, "-").alias("padded"))
540
- * shape: (1, 2)
541
- * ┌──────┬────────┐
542
- * │ text padded │
543
- * ├──────┼────────┤
544
- * │ a a-- │
545
- * └──────┴────────┘
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
+ * └──────────┴──────────┘
546
903
  */
547
904
  rpad(width: number, fill?: string): any;
548
905
  /**
@@ -551,14 +908,25 @@ export declare class StringExprNamespace {
551
908
  * @param length Number of characters to include.
552
909
  * @returns ColumnExpression
553
910
  * @example
554
- * >>> const df = $df.data({ str: ["hello world"] })
555
- * >>> df.with_columns($df.col("str").str.slice(0, 5).alias("sub"))
556
- * shape: (1, 2)
557
- * ┌─────────────┬───────┐
558
- * │ str sub │
559
- * ├─────────────┼───────┤
560
- * │ hello world hello │
561
- * └─────────────┴───────┘
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
+ * └──────────┴─────┘
562
930
  */
563
931
  slice(offset: number, length?: number): any;
564
932
  /**
@@ -567,14 +935,24 @@ export declare class StringExprNamespace {
567
935
  * @param options Options for controlling limit and exact padding.
568
936
  * @returns ColumnExpression
569
937
  * @example
570
- * >>> const df = $df.data({ csv: ["a,b,c"] })
571
- * >>> df.with_columns($df.col("csv").str.split(",", { limit: 1 }).alias("items"))
572
- * shape: (1, 2)
573
- * ┌───────┬─────────────────┐
574
- * │ csv items │
575
- * ├───────┼─────────────────┤
576
- * │ a,b,c │ ["a", "b,c"]
577
- * └───────┴─────────────────┘
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
+ * └──────────────────┴────────────────────────┘
578
956
  */
579
957
  split(delimiter: string, options?: SplitOptions): any;
580
958
  /**
@@ -582,118 +960,198 @@ export declare class StringExprNamespace {
582
960
  * @param prefix The prefix substring.
583
961
  * @returns ColumnExpression
584
962
  * @example
585
- * >>> const df = $df.data({ name: ["John Doe", "Alice"] })
586
- * >>> df.with_columns($df.col("name").str.starts_with("John").alias("is_john"))
587
- * shape: (2, 2)
588
- * ┌──────────┬─────────┐
589
- * │ name is_john │
590
- * ├──────────┼─────────┤
591
- * │ John Doe true │
592
- * │ Alice │ false
593
- * └──────────┴─────────┘
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
+ * └──────────┴──────────┘
594
982
  */
595
- starts_with(prefix: string): any;
983
+ startsWith(prefix: string): any;
596
984
  /**
597
985
  * Strips matching characters from start and end of string.
598
986
  * @param characters Characters or regex pattern to strip.
599
987
  * @param options Configuration options for strip operation.
600
988
  * @returns ColumnExpression
601
989
  * @example
602
- * >>> const df = $df.data({ text: ["--hello--"] })
603
- * >>> df.with_columns($df.col("text").str.strip_chars("-").alias("stripped"))
604
- * shape: (1, 2)
605
- * ┌───────────┬──────────┐
606
- * │ text stripped │
607
- * ├───────────┼──────────┤
608
- * │ --hello-- hello │
609
- * └───────────┴──────────┘
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
+ * └─────────────┴──────────┘
610
1008
  */
611
- strip_chars(characters?: string | RegExp, options?: StripCharsOptions): any;
1009
+ stripChars(characters?: string | RegExp, options?: StripCharsOptions): any;
612
1010
  /**
613
1011
  * Strips matching characters from end of string.
614
1012
  * @param characters Characters or regex pattern to strip.
615
1013
  * @param options Configuration options.
616
1014
  * @returns ColumnExpression
617
1015
  * @example
618
- * >>> const df = $df.data({ text: ["hello--"] })
619
- * >>> df.with_columns($df.col("text").str.strip_chars_end("-").alias("stripped"))
620
- * shape: (1, 2)
621
- * ┌─────────┬──────────┐
622
- * │ text stripped │
623
- * ├─────────┼──────────┤
624
- * │ hello-- hello │
625
- * └─────────┴──────────┘
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
+ * └─────────────┴──────────┘
626
1034
  */
627
- strip_chars_end(characters?: string | RegExp, options?: StripCharsOptions): any;
1035
+ stripCharsEnd(characters?: string | RegExp, options?: StripCharsOptions): any;
628
1036
  /**
629
1037
  * Strips matching characters from start of string.
630
1038
  * @param characters Characters or regex pattern to strip.
631
1039
  * @param options Configuration options.
632
1040
  * @returns ColumnExpression
633
1041
  * @example
634
- * >>> const df = $df.data({ text: ["--hello"] })
635
- * >>> df.with_columns($df.col("text").str.strip_chars_start("-").alias("stripped"))
636
- * shape: (1, 2)
637
- * ┌─────────┬──────────┐
638
- * │ text stripped │
639
- * ├─────────┼──────────┤
640
- * │ --hello hello │
641
- * └─────────┴──────────┘
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
+ * └─────────────┴──────────┘
642
1060
  */
643
- strip_chars_start(characters?: string | RegExp, options?: StripCharsOptions): any;
1061
+ stripCharsStart(characters?: string | RegExp, options?: StripCharsOptions): any;
644
1062
  /**
645
1063
  * Strips matching prefix substring from start of string.
646
1064
  * @param prefix Prefix substring to remove.
647
1065
  * @returns ColumnExpression
648
1066
  * @example
649
- * >>> const df = $df.data({ text: ["pre_fix"] })
650
- * >>> df.with_columns($df.col("text").str.strip_prefix("pre_").alias("stripped"))
651
- * shape: (1, 2)
652
- * ┌─────────┬──────────┐
653
- * │ text stripped │
654
- * ├─────────┼──────────┤
655
- * │ pre_fix fix │
656
- * └─────────┴──────────┘
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
+ * └─────────────┴──────────┘
657
1086
  */
658
- strip_prefix(prefix: string): any;
1087
+ stripPrefix(prefix: string): any;
659
1088
  /**
660
1089
  * Strips matching suffix substring from end of string.
661
1090
  * @param suffix Suffix substring to remove.
662
1091
  * @returns ColumnExpression
663
1092
  * @example
664
- * >>> const df = $df.data({ text: ["fix_post"] })
665
- * >>> df.with_columns($df.col("text").str.strip_suffix("_post").alias("stripped"))
666
- * shape: (1, 2)
667
- * ┌──────────┬──────────┐
668
- * │ text stripped │
669
- * ├──────────┼──────────┤
670
- * │ fix_post fix │
671
- * └──────────┴──────────┘
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
+ * └──────────────────┴────────────────┘
672
1111
  */
673
- strip_suffix(suffix: string): any;
1112
+ stripSuffix(suffix: string): any;
674
1113
  /**
675
1114
  * Extracts the last n characters of each string element.
676
1115
  * @param n Number of characters to extract from the end of the string (default 1).
677
1116
  * @returns ColumnExpression
678
1117
  * @example
679
- * >>> const df = $df.data({ name: ["polars", "javascript"] })
680
- * >>> df.with_columns($df.col("name").str.tail(3).alias("suffix"))
681
- * shape: (2, 2)
682
- * ┌────────────┬────────┐
683
- * │ name suffix │
684
- * ├────────────┼────────┤
685
- * │ polars ars │
686
- * │ javascript ipt │
687
- * └────────────┴────────┘
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
+ * └──────────┴────────┘
688
1137
  */
689
1138
  tail(n?: number): any;
690
1139
  /**
691
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"`.
692
1143
  * @param options Parsing configuration options.
693
1144
  * @returns ColumnExpression
694
1145
  * @example
695
- * >>> const df = $df.data({ d: ["2026-05-20"] })
696
- * >>> 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"))
697
1155
  * shape: (1, 2)
698
1156
  * ┌────────────┬──────────────────────────┐
699
1157
  * │ d │ parsed │
@@ -706,22 +1164,40 @@ export declare class StringExprNamespace {
706
1164
  * Converts string casing to camelCase.
707
1165
  * @returns ColumnExpression
708
1166
  * @example
709
- * >>> const df = $df.data({ text: ["hello_world"] })
710
- * >>> df.with_columns($df.col("text").str.to_camelcase().alias("camel"))
711
- * shape: (1, 2)
712
- * ┌─────────────┬────────────┐
713
- * │ text camel │
714
- * ├─────────────┼────────────┤
715
- * │ hello_world helloWorld │
716
- * └─────────────┴────────────┘
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
+ * └─────────────┴───────────┘
717
1186
  */
718
- to_camelcase(): any;
1187
+ toCamelCase(): any;
719
1188
  /**
720
1189
  * Parses string into Date object.
721
1190
  * @returns ColumnExpression
722
1191
  * @example
723
- * >>> const df = $df.data({ d: ["2026-05-20"] })
724
- * >>> 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"))
725
1201
  * shape: (1, 2)
726
1202
  * ┌────────────┬──────────────────────────┐
727
1203
  * │ d │ date │
@@ -729,216 +1205,350 @@ export declare class StringExprNamespace {
729
1205
  * │ 2026-05-20 │ 2026-05-20T00:00:00.000Z │
730
1206
  * └────────────┴──────────────────────────┘
731
1207
  */
732
- to_date(): any;
1208
+ toDate(): any;
733
1209
  /**
734
1210
  * Parses string into Datetime value.
735
1211
  * @returns ColumnExpression
736
1212
  * @example
737
- * >>> const df = $df.data({ ts: ["2026-05-20T10:00:00Z"] })
738
- * >>> 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"))
739
1222
  * shape: (1, 2)
740
- * ┌──────────────────────┬──────────────────────────┐
741
- * │ ts │ dt │
742
- * ├──────────────────────┼──────────────────────────┤
743
- * │ 2026-05-20T10:00:00Z │ 2026-05-20T10:00:00.000Z │
744
- * └──────────────────────┴──────────────────────────┘
1223
+ * ┌────────────┬──────────────────────────┐
1224
+ * │ d │ dt │
1225
+ * ├────────────┼──────────────────────────┤
1226
+ * │ 2026-05-20 │ 2026-05-20T00:00:00.000Z │
1227
+ * └────────────┴──────────────────────────┘
745
1228
  */
746
- to_datetime(): any;
1229
+ toDatetime(): any;
747
1230
  /**
748
1231
  * Converts string into numeric decimal representation.
749
1232
  * @param precision Optional precision limit.
750
1233
  * @param scale Optional scale limit.
751
1234
  * @returns ColumnExpression
752
1235
  * @example
753
- * >>> const df = $df.data({ val: ["12.34"] })
754
- * >>> df.with_columns($df.col("val").str.to_decimal().alias("num"))
755
- * shape: (1, 2)
756
- * ┌───────┬───────┐
757
- * │ val num │
758
- * ├───────┼───────┤
759
- * │ 12.34 12.34 │
760
- * └───────┴───────┘
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
+ * └──────────┴─────┘
761
1255
  */
762
- to_decimal(precision?: number, scale?: number): any;
1256
+ toDecimal(precision?: number, scale?: number): any;
763
1257
  /**
764
1258
  * Parses string into integer number.
765
1259
  * @returns ColumnExpression
766
1260
  * @example
767
- * >>> const df = $df.data({ val: ["42"] })
768
- * >>> df.with_columns($df.col("val").str.to_integer().alias("num"))
769
- * shape: (1, 2)
770
- * ┌─────┬─────┐
771
- * │ val num │
772
- * ├─────┼─────┤
773
- * │ 42 42 │
774
- * └─────┴─────┘
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
+ * └──────────┴─────┘
775
1280
  */
776
- to_integer(): any;
1281
+ toInteger(): any;
777
1282
  /**
778
1283
  * Converts string casing to kebab-case.
779
1284
  * @returns ColumnExpression
780
1285
  * @example
781
- * >>> const df = $df.data({ text: ["helloWorld"] })
782
- * >>> df.with_columns($df.col("text").str.to_kebabcase().alias("kebab"))
783
- * shape: (1, 2)
784
- * ┌────────────┬─────────────┐
785
- * │ text kebab │
786
- * ├────────────┼─────────────┤
787
- * │ helloWorld hello-world │
788
- * └────────────┴─────────────┘
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
+ * └─────────────┴───────────┘
789
1305
  */
790
- to_kebabcase(): any;
1306
+ toKebabCase(): any;
791
1307
  /**
792
1308
  * Converts all string elements in the column to lowercase.
793
1309
  * @returns ColumnExpression
794
1310
  * @example
795
- * >>> const df = $df.data({
796
- * ... c: ["ALICE", "Bob", "charlie"]
797
- * ... })
798
- * shape: (3, 1)
799
- * ┌─────────┐
800
- * │ c │
801
- * ├─────────┤
802
- * │ ALICE
803
- * │ Bob
804
- * │ charlie │
805
- * └─────────┘
806
- *
807
- * >>> df.with_columns($df.col("c").str.to_lowercase().alias("lower_name"))
808
- * shape: (3, 2)
809
- * ┌─────────┬────────────┐
810
- * │ c lower_name
811
- * ├─────────┼────────────┤
812
- * │ ALICE alice
813
- * │ Bob │ bob │
814
- * │ charlie │ charlie │
815
- * └─────────┴────────────┘
816
- */
817
- 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;
818
1332
  /**
819
1333
  * Converts string casing to PascalCase.
820
1334
  * @returns ColumnExpression
821
1335
  * @example
822
- * >>> const df = $df.data({ text: ["hello_world"] })
823
- * >>> df.with_columns($df.col("text").str.to_pascalcase().alias("pascal"))
824
- * shape: (1, 2)
825
- * ┌─────────────┬────────────┐
826
- * │ text pascal │
827
- * ├─────────────┼────────────┤
828
- * │ hello_world HelloWorld │
829
- * └─────────────┴────────────┘
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
+ * └─────────────┴───────────┘
830
1355
  */
831
- to_pascalcase(): any;
1356
+ toPascalCase(): any;
832
1357
  /**
833
1358
  * Converts string casing to snake_case.
834
1359
  * @returns ColumnExpression
835
1360
  * @example
836
- * >>> const df = $df.data({ text: ["helloWorld"] })
837
- * >>> df.with_columns($df.col("text").str.to_snakecase().alias("snake"))
838
- * shape: (1, 2)
839
- * ┌────────────┬─────────────┐
840
- * │ text snake │
841
- * ├────────────┼─────────────┤
842
- * │ helloWorld hello_world │
843
- * └────────────┴─────────────┘
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
+ * └─────────────┴───────────┘
844
1380
  */
845
- to_snakecase(): any;
1381
+ toSnakeCase(): any;
846
1382
  /**
847
1383
  * Parses string into time component representation.
848
1384
  * @returns ColumnExpression
849
1385
  * @example
850
- * >>> const df = $df.data({ t: ["10:30:00"] })
851
- * >>> df.with_columns($df.col("t").str.to_time().alias("time"))
852
- * shape: (1, 2)
853
- * ┌──────────┬──────────┐
854
- * │ t time │
855
- * ├──────────┼──────────┤
856
- * │ 10:30:00 10:30:00 │
857
- * └──────────┴──────────┘
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
+ * └──────────┴──────┘
858
1405
  */
859
- to_time(): any;
1406
+ toTime(): any;
860
1407
  /**
861
1408
  * Converts string casing to Title Case.
862
1409
  * @returns ColumnExpression
863
1410
  * @example
864
- * >>> const df = $df.data({ text: ["hello world"] })
865
- * >>> df.with_columns($df.col("text").str.to_titlecase().alias("title"))
866
- * shape: (1, 2)
867
- * ┌─────────────┬─────────────┐
868
- * │ text title │
869
- * ├─────────────┼─────────────┤
870
- * │ hello world Hello World │
871
- * └─────────────┴─────────────┘
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
+ * └─────────────┴───────────┘
872
1430
  */
873
- to_titlecase(): any;
1431
+ toTitleCase(): any;
874
1432
  /**
875
1433
  * Converts all string elements in the column to uppercase.
876
1434
  * @returns ColumnExpression
877
1435
  * @example
878
- * >>> const df = $df.data({ name: ["alice"] })
879
- * >>> df.with_columns($df.col("name").str.to_uppercase().alias("upper"))
880
- * shape: (1, 2)
881
- * ┌───────┬───────┐
882
- * │ name upper │
883
- * ├───────┼───────┤
884
- * │ alice ALICE │
885
- * └───────┴───────┘
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
+ * └─────────────┴───────────┘
886
1455
  */
887
- to_uppercase(): any;
1456
+ toUpperCase(): any;
888
1457
  /**
889
1458
  * Trims leading and trailing whitespace characters from each string element.
890
1459
  * @returns ColumnExpression
891
1460
  * @example
892
- * >>> const df = $df.data({ name: [" alice "] })
893
- * >>> df.with_columns($df.col("name").str.trim().alias("clean"))
894
- * shape: (1, 2)
895
- * ┌───────────┬───────┐
896
- * │ name clean │
897
- * ├───────────┼───────┤
898
- * │ alice │ alice
899
- * └───────────┴───────┘
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
+ * └─────────────┴───────┘
900
1479
  */
901
1480
  trim(): any;
902
1481
  /**
903
1482
  * Trims trailing whitespace characters from each string element.
904
1483
  * @returns ColumnExpression
905
1484
  * @example
906
- * >>> const df = $df.data({ name: ["alice "] })
907
- * >>> df.with_columns($df.col("name").str.trim_end().alias("clean"))
908
- * shape: (1, 2)
909
- * ┌─────────┬───────┐
910
- * │ name clean │
911
- * ├─────────┼───────┤
912
- * │ alice alice │
913
- * └─────────┴───────┘
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
+ * └─────────────┴──────────┘
914
1503
  */
915
- trim_end(): any;
1504
+ trimEnd(): any;
916
1505
  /**
917
1506
  * Trims leading whitespace characters from each string element.
918
1507
  * @returns ColumnExpression
919
1508
  * @example
920
- * >>> const df = $df.data({ name: [" alice"] })
921
- * >>> df.with_columns($df.col("name").str.trim_start().alias("clean"))
922
- * shape: (1, 2)
923
- * ┌─────────┬───────┐
924
- * │ name clean │
925
- * ├─────────┼───────┤
926
- * │ alice alice │
927
- * └─────────┴───────┘
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
+ * └─────────────┴──────────┘
928
1527
  */
929
- trim_start(): any;
1528
+ trimStart(): any;
930
1529
  /**
931
1530
  * Converts string to uppercase.
932
1531
  * @returns ColumnExpression
933
1532
  * @example
934
- * >>> const df = $df.data({ text: ["alice"] })
935
- * >>> df.with_columns($df.col("text").str.upper().alias("upper"))
936
- * shape: (1, 2)
937
- * ┌───────┬───────┐
938
- * │ text upper │
939
- * ├───────┼───────┤
940
- * │ alice ALICE │
941
- * └───────┴───────┘
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
+ * └─────────────┴───────────┘
942
1552
  */
943
1553
  upper(): any;
944
1554
  /**
@@ -946,14 +1556,25 @@ export declare class StringExprNamespace {
946
1556
  * @param width Minimum resulting string width.
947
1557
  * @returns ColumnExpression
948
1558
  * @example
949
- * >>> const df = $df.data({ num: ["42"] })
950
- * >>> df.with_columns($df.col("num").str.zfill(5).alias("padded"))
951
- * shape: (1, 2)
952
- * ┌─────┬────────┐
953
- * │ num padded │
954
- * ├─────┼────────┤
955
- * │ 42 00042 │
956
- * └─────┴────────┘
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
+ * └──────────┴──────────┘
957
1578
  */
958
1579
  zfill(width: number): any;
959
1580
  }
@@ -965,7 +1586,25 @@ export declare class StringExpr extends ExprBase {
965
1586
  * @syntax $df.col(<column_name>).str
966
1587
  * @returns StringExprNamespace
967
1588
  * @example
968
- * >>> 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
+ * └─────┘
969
1608
  */
970
1609
  get str(): StringExprNamespace;
971
1610
  }