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
@@ -10,11 +10,18 @@ export declare class LogicalExpr extends ExprBase {
10
10
  * @param other The other boolean column expression or literal value to compare.
11
11
  * @returns ColumnExpression
12
12
  * @example
13
- * >>> const df = $df.data({
14
- * ... a: [true, true, false, null],
15
- * ... b: [true, false, false, true]
16
- * ... })
17
- * >>> df.with_columns($df.col("a").and($df.col("b")).alias("and_res"))
13
+ * >>> const df = $df.data({ a: [true, true, false, false], b: [true, false, true, false] })
14
+ * >>> df
15
+ * shape: (4, 2)
16
+ * ┌───────┬───────┐
17
+ * ab
18
+ * ├───────┼───────┤
19
+ * │ true │ true │
20
+ * │ true │ false │
21
+ * │ false │ true │
22
+ * │ false │ false │
23
+ * └───────┴───────┘
24
+ * >>> df.withColumns($df.col("a").and($df.col("b")).alias("and_res"))
18
25
  * shape: (4, 3)
19
26
  * ┌───────┬───────┬─────────┐
20
27
  * │ a │ b │ and_res │
@@ -30,18 +37,27 @@ export declare class LogicalExpr extends ExprBase {
30
37
  * Logical negation.
31
38
  * @returns ColumnExpression
32
39
  * @example
33
- * >>> const df = $df.data({
34
- * ... is_active: [true, false, null]
35
- * ... })
36
- * >>> df.with_columns($df.col("is_active").not().alias("is_inactive"))
37
- * shape: (3, 2)
38
- * ┌───────────┬─────────────┐
39
- * │ is_active is_inactive
40
- * ├───────────┼─────────────┤
41
- * │ true false
42
- * │ false true
43
- * │ null │ null │
44
- * └───────────┴─────────────┘
40
+ * >>> const df = $df.data({ a: [true, true, false, false], b: [true, false, true, false] })
41
+ * >>> df
42
+ * shape: (4, 2)
43
+ * ┌───────┬───────┐
44
+ * a │ b │
45
+ * ├───────┼───────┤
46
+ * │ true true
47
+ * │ true │ false │
48
+ * │ false true
49
+ * │ false false
50
+ * └───────┴───────┘
51
+ * >>> df.withColumns($df.col("a").not().alias("not_a"))
52
+ * shape: (4, 3)
53
+ * ┌───────┬───────┬───────┐
54
+ * │ a │ b │ not_a │
55
+ * ├───────┼───────┼───────┤
56
+ * │ true │ true │ false │
57
+ * │ true │ false │ false │
58
+ * │ false │ false │ true │
59
+ * │ null │ true │ null │
60
+ * └───────┴───────┴───────┘
45
61
  */
46
62
  not(): this;
47
63
  /**
@@ -49,19 +65,26 @@ export declare class LogicalExpr extends ExprBase {
49
65
  * @param other The other boolean column expression or literal value to compare.
50
66
  * @returns ColumnExpression
51
67
  * @example
52
- * >>> const df = $df.data({
53
- * ... a: [true, false, false, null],
54
- * ... b: [false, false, true, false]
55
- * ... })
56
- * >>> df.with_columns($df.col("a").or($df.col("b")).alias("or_res"))
68
+ * >>> const df = $df.data({ a: [true, true, false, false], b: [true, false, true, false] })
69
+ * >>> df
70
+ * shape: (4, 2)
71
+ * ┌───────┬───────┐
72
+ * ab
73
+ * ├───────┼───────┤
74
+ * │ true │ true │
75
+ * │ true │ false │
76
+ * │ false │ true │
77
+ * │ false │ false │
78
+ * └───────┴───────┘
79
+ * >>> df.withColumns($df.col("a").or($df.col("b")).alias("or_res"))
57
80
  * shape: (4, 3)
58
81
  * ┌───────┬───────┬────────┐
59
82
  * │ a │ b │ or_res │
60
83
  * ├───────┼───────┼────────┤
84
+ * │ true │ true │ true │
61
85
  * │ true │ false │ true │
62
86
  * │ false │ false │ false │
63
- * │ false │ true │ true │
64
- * │ null │ false │ null │
87
+ * │ null │ true │ true │
65
88
  * └───────┴───────┴────────┘
66
89
  */
67
90
  or(other: any): this;
@@ -70,11 +93,18 @@ export declare class LogicalExpr extends ExprBase {
70
93
  * @param other The other boolean column expression or literal value to compare.
71
94
  * @returns ColumnExpression
72
95
  * @example
73
- * >>> const df = $df.data({
74
- * ... a: [true, true, false, false],
75
- * ... b: [true, false, true, false]
76
- * ... })
77
- * >>> df.with_columns($df.col("a").xor($df.col("b")).alias("xor_res"))
96
+ * >>> const df = $df.data({ a: [true, true, false, false], b: [true, false, true, false] })
97
+ * >>> df
98
+ * shape: (4, 2)
99
+ * ┌───────┬───────┐
100
+ * ab
101
+ * ├───────┼───────┤
102
+ * │ true │ true │
103
+ * │ true │ false │
104
+ * │ false │ true │
105
+ * │ false │ false │
106
+ * └───────┴───────┘
107
+ * >>> df.withColumns($df.col("a").xor($df.col("b")).alias("xor_res"))
78
108
  * shape: (4, 3)
79
109
  * ┌───────┬───────┬─────────┐
80
110
  * │ a │ b │ xor_res │
@@ -11,10 +11,17 @@ export declare class ManipulationExpr extends ExprBase {
11
11
  * @param options Configuration options including fill value, strategy ("forward", "backward", "zero", "one", "mean", "min", "max"), and optional limit.
12
12
  * @returns ColumnExpression
13
13
  * @example
14
- * >>> const df = $df.data({
15
- * ... a: [1, null, 3]
16
- * ... })
17
- * >>> df.with_columns($df.col("a").fill_null({ value: 0 }).alias("filled"))
14
+ * >>> const df = $df.data({ a: [1, null, 3], b: [null, 2, null] })
15
+ * >>> df
16
+ * shape: (3, 2)
17
+ * ┌──────┬──────┐
18
+ * │ a │ b │
19
+ * ├──────┼──────┤
20
+ * │ 1 │ null │
21
+ * │ null │ 2 │
22
+ * │ 3 │ null │
23
+ * └──────┴──────┘
24
+ * >>> df.withColumns($df.col("a").fillNull({ value: 0 }).alias("filled"))
18
25
  * shape: (3, 2)
19
26
  * ┌──────┬────────┐
20
27
  * │ a │ filled │
@@ -24,15 +31,22 @@ export declare class ManipulationExpr extends ExprBase {
24
31
  * │ 3 │ 3 │
25
32
  * └──────┴────────┘
26
33
  */
27
- fill_null({ value, strategy, limit }?: FillNullOptions): this;
34
+ fillNull({ value, strategy, limit }?: FillNullOptions): this;
28
35
  /**
29
36
  * Reverses the order of values in the column.
30
37
  * @returns ColumnExpression
31
38
  * @example
32
- * >>> const df = $df.data({
33
- * ... a: [1, 2, 3]
34
- * ... })
35
- * >>> df.with_columns($df.col("a").reverse().alias("reversed"))
39
+ * >>> const df = $df.data({ a: [1, 2, 3] })
40
+ * >>> df
41
+ * shape: (3, 1)
42
+ * ┌───┐
43
+ * │ a │
44
+ * ├───┤
45
+ * │ 1 │
46
+ * │ 2 │
47
+ * │ 3 │
48
+ * └───┘
49
+ * >>> df.withColumns($df.col("a").reverse().alias("reversed"))
36
50
  * shape: (3, 2)
37
51
  * ┌───┬──────────┐
38
52
  * │ a │ reversed │