df-script 1.4.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.
- package/LICENSE +21 -0
- package/README.md +269 -0
- package/dist/api.d.ts +39 -0
- package/dist/api.js +18 -0
- package/dist/bundle.min.js +1 -0
- package/dist/columnExpressions/ColumnExpr.d.ts +368 -0
- package/dist/columnExpressions/ColumnExpr.js +23 -0
- package/dist/columnExpressions/ExprBase.d.ts +24 -0
- package/dist/columnExpressions/ExprBase.js +133 -0
- package/dist/columnExpressions/constants.d.ts +2 -0
- package/dist/columnExpressions/constants.js +5 -0
- package/dist/columnExpressions/functions/all.d.ts +5 -0
- package/dist/columnExpressions/functions/all.js +11 -0
- package/dist/columnExpressions/functions/coalesce.d.ts +3 -0
- package/dist/columnExpressions/functions/coalesce.js +40 -0
- package/dist/columnExpressions/functions/exclude.d.ts +5 -0
- package/dist/columnExpressions/functions/exclude.js +13 -0
- package/dist/columnExpressions/functions/lit.d.ts +5 -0
- package/dist/columnExpressions/functions/lit.js +22 -0
- package/dist/columnExpressions/functions/when.d.ts +24 -0
- package/dist/columnExpressions/functions/when.js +81 -0
- package/dist/columnExpressions/index.d.ts +19 -0
- package/dist/columnExpressions/index.js +81 -0
- package/dist/columnExpressions/mixins/AggregationExpr.d.ts +50 -0
- package/dist/columnExpressions/mixins/AggregationExpr.js +172 -0
- package/dist/columnExpressions/mixins/ArithmeticExpr.d.ts +67 -0
- package/dist/columnExpressions/mixins/ArithmeticExpr.js +143 -0
- package/dist/columnExpressions/mixins/ComparisonExpr.d.ts +60 -0
- package/dist/columnExpressions/mixins/ComparisonExpr.js +389 -0
- package/dist/columnExpressions/mixins/ListExpr.d.ts +63 -0
- package/dist/columnExpressions/mixins/ListExpr.js +248 -0
- package/dist/columnExpressions/mixins/LogicalExpr.d.ts +33 -0
- package/dist/columnExpressions/mixins/LogicalExpr.js +54 -0
- package/dist/columnExpressions/mixins/ManipulationExpr.d.ts +31 -0
- package/dist/columnExpressions/mixins/ManipulationExpr.js +35 -0
- package/dist/columnExpressions/mixins/StringExpr.d.ts +79 -0
- package/dist/columnExpressions/mixins/StringExpr.js +249 -0
- package/dist/columnExpressions/mixins/TemporalExpr.d.ts +69 -0
- package/dist/columnExpressions/mixins/TemporalExpr.js +127 -0
- package/dist/columnExpressions/mixins/WindowExpr.d.ts +50 -0
- package/dist/columnExpressions/mixins/WindowExpr.js +281 -0
- package/dist/columnExpressions/types.d.ts +7 -0
- package/dist/columnExpressions/types.js +2 -0
- package/dist/dataframe/constants.d.ts +1 -0
- package/dist/dataframe/constants.js +4 -0
- package/dist/dataframe/dataframe.d.ts +42 -0
- package/dist/dataframe/dataframe.js +749 -0
- package/dist/dataframe/grouped/grouped.d.ts +15 -0
- package/dist/dataframe/grouped/grouped.js +113 -0
- package/dist/dataframe/index.d.ts +4 -0
- package/dist/dataframe/index.js +20 -0
- package/dist/dataframe/types.d.ts +33 -0
- package/dist/dataframe/types.js +2 -0
- package/dist/dataframe/utils.d.ts +11 -0
- package/dist/dataframe/utils.js +215 -0
- package/dist/datatypes/DataType.d.ts +40 -0
- package/dist/datatypes/DataType.js +47 -0
- package/dist/datatypes/index.d.ts +29 -0
- package/dist/datatypes/index.js +46 -0
- package/dist/datatypes/types/Binary.d.ts +9 -0
- package/dist/datatypes/types/Binary.js +18 -0
- package/dist/datatypes/types/Boolean.d.ts +9 -0
- package/dist/datatypes/types/Boolean.js +19 -0
- package/dist/datatypes/types/Date.d.ts +8 -0
- package/dist/datatypes/types/Date.js +21 -0
- package/dist/datatypes/types/Datetime.d.ts +8 -0
- package/dist/datatypes/types/Datetime.js +17 -0
- package/dist/datatypes/types/Decimal.d.ts +10 -0
- package/dist/datatypes/types/Decimal.js +28 -0
- package/dist/datatypes/types/Duration.d.ts +8 -0
- package/dist/datatypes/types/Duration.js +17 -0
- package/dist/datatypes/types/Float32.d.ts +8 -0
- package/dist/datatypes/types/Float32.js +17 -0
- package/dist/datatypes/types/Float64.d.ts +8 -0
- package/dist/datatypes/types/Float64.js +17 -0
- package/dist/datatypes/types/Int16.d.ts +8 -0
- package/dist/datatypes/types/Int16.js +17 -0
- package/dist/datatypes/types/Int32.d.ts +8 -0
- package/dist/datatypes/types/Int32.js +17 -0
- package/dist/datatypes/types/Int64.d.ts +8 -0
- package/dist/datatypes/types/Int64.js +17 -0
- package/dist/datatypes/types/Int8.d.ts +8 -0
- package/dist/datatypes/types/Int8.js +17 -0
- package/dist/datatypes/types/List.d.ts +10 -0
- package/dist/datatypes/types/List.js +31 -0
- package/dist/datatypes/types/Null.d.ts +9 -0
- package/dist/datatypes/types/Null.js +17 -0
- package/dist/datatypes/types/Object.d.ts +9 -0
- package/dist/datatypes/types/Object.js +17 -0
- package/dist/datatypes/types/Struct.d.ts +14 -0
- package/dist/datatypes/types/Struct.js +39 -0
- package/dist/datatypes/types/Time.d.ts +8 -0
- package/dist/datatypes/types/Time.js +29 -0
- package/dist/datatypes/types/UInt16.d.ts +8 -0
- package/dist/datatypes/types/UInt16.js +17 -0
- package/dist/datatypes/types/UInt32.d.ts +8 -0
- package/dist/datatypes/types/UInt32.js +17 -0
- package/dist/datatypes/types/UInt64.d.ts +8 -0
- package/dist/datatypes/types/UInt64.js +17 -0
- package/dist/datatypes/types/UInt8.d.ts +8 -0
- package/dist/datatypes/types/UInt8.js +17 -0
- package/dist/datatypes/types/Utf8.d.ts +10 -0
- package/dist/datatypes/types/Utf8.js +20 -0
- package/dist/datatypes/types.d.ts +172 -0
- package/dist/datatypes/types.js +286 -0
- package/dist/exceptions/index.d.ts +13 -0
- package/dist/exceptions/index.js +43 -0
- package/dist/exceptions/utils.d.ts +2 -0
- package/dist/exceptions/utils.js +9 -0
- package/dist/functions/concat.d.ts +4 -0
- package/dist/functions/concat.js +248 -0
- package/dist/functions/index.d.ts +1 -0
- package/dist/functions/index.js +17 -0
- package/dist/index.d.ts +7 -0
- package/dist/index.js +1 -0
- package/dist/types.d.ts +47 -0
- package/dist/types.js +2 -0
- package/dist/utils/boolean.d.ts +1 -0
- package/dist/utils/boolean.js +18 -0
- package/dist/utils/date.d.ts +57 -0
- package/dist/utils/date.js +349 -0
- package/dist/utils/guards.d.ts +14 -0
- package/dist/utils/guards.js +143 -0
- package/dist/utils/index.d.ts +5 -0
- package/dist/utils/index.js +21 -0
- package/dist/utils/json.d.ts +2 -0
- package/dist/utils/json.js +33 -0
- package/dist/utils/list.d.ts +23 -0
- package/dist/utils/list.js +128 -0
- package/dist/utils/number.d.ts +86 -0
- package/dist/utils/number.js +223 -0
- package/dist/utils/string.d.ts +52 -0
- package/dist/utils/string.js +120 -0
- package/package.json +34 -0
|
@@ -0,0 +1,281 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.WindowExpr = void 0;
|
|
4
|
+
const ExprBase_1 = require("../ExprBase");
|
|
5
|
+
const utils_1 = require("../../utils");
|
|
6
|
+
const WindowExpr = (Base) => {
|
|
7
|
+
return class extends Base {
|
|
8
|
+
partitionBy = this.partitionBy || null;
|
|
9
|
+
_rolling(windowSize, aggFn) {
|
|
10
|
+
const newInst = (0, ExprBase_1.derive)(this);
|
|
11
|
+
newInst.partitionOpsIndex = this.ops.length;
|
|
12
|
+
newInst.groupingOpsIndex = this.ops.length;
|
|
13
|
+
newInst.evaluateWindow = function (groupPreValues, _partitionIndices, currentIndex) {
|
|
14
|
+
const start = Math.max(0, currentIndex - windowSize + 1);
|
|
15
|
+
const end = currentIndex + 1;
|
|
16
|
+
const windowVals = groupPreValues.slice(start, end);
|
|
17
|
+
return aggFn(windowVals);
|
|
18
|
+
};
|
|
19
|
+
return newInst;
|
|
20
|
+
}
|
|
21
|
+
get isWindow() {
|
|
22
|
+
return this.partitionBy !== null || this.evaluateWindow !== undefined || this.aggFn !== null;
|
|
23
|
+
}
|
|
24
|
+
cum_count(reverse = false) {
|
|
25
|
+
const newInst = (0, ExprBase_1.derive)(this);
|
|
26
|
+
newInst.partitionOpsIndex = this.ops.length;
|
|
27
|
+
newInst.groupingOpsIndex = this.ops.length;
|
|
28
|
+
newInst.evaluateWindow = function (groupPreValues, _partitionIndices, currentIndex) {
|
|
29
|
+
let count = 0;
|
|
30
|
+
const start = reverse ? currentIndex : 0;
|
|
31
|
+
const end = reverse ? groupPreValues.length - 1 : currentIndex;
|
|
32
|
+
for (let i = start; i <= end; i++) {
|
|
33
|
+
const val = groupPreValues[i];
|
|
34
|
+
if (val != null)
|
|
35
|
+
count++;
|
|
36
|
+
}
|
|
37
|
+
return count;
|
|
38
|
+
};
|
|
39
|
+
return newInst;
|
|
40
|
+
}
|
|
41
|
+
cum_max(reverse = false) {
|
|
42
|
+
const newInst = (0, ExprBase_1.derive)(this);
|
|
43
|
+
newInst.partitionOpsIndex = this.ops.length;
|
|
44
|
+
newInst.groupingOpsIndex = this.ops.length;
|
|
45
|
+
newInst.evaluateWindow = function (groupPreValues, _partitionIndices, currentIndex) {
|
|
46
|
+
let maxVal = null;
|
|
47
|
+
const start = reverse ? currentIndex : 0;
|
|
48
|
+
const end = reverse ? groupPreValues.length - 1 : currentIndex;
|
|
49
|
+
for (let i = start; i <= end; i++) {
|
|
50
|
+
const val = groupPreValues[i];
|
|
51
|
+
if (val != null) {
|
|
52
|
+
if (maxVal === null || val > maxVal) {
|
|
53
|
+
maxVal = val;
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
return maxVal;
|
|
58
|
+
};
|
|
59
|
+
return newInst;
|
|
60
|
+
}
|
|
61
|
+
cum_min(reverse = false) {
|
|
62
|
+
const newInst = (0, ExprBase_1.derive)(this);
|
|
63
|
+
newInst.partitionOpsIndex = this.ops.length;
|
|
64
|
+
newInst.groupingOpsIndex = this.ops.length;
|
|
65
|
+
newInst.evaluateWindow = function (groupPreValues, _partitionIndices, currentIndex) {
|
|
66
|
+
let minVal = null;
|
|
67
|
+
const start = reverse ? currentIndex : 0;
|
|
68
|
+
const end = reverse ? groupPreValues.length - 1 : currentIndex;
|
|
69
|
+
for (let i = start; i <= end; i++) {
|
|
70
|
+
const val = groupPreValues[i];
|
|
71
|
+
if (val != null) {
|
|
72
|
+
if (minVal === null || val < minVal) {
|
|
73
|
+
minVal = val;
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
return minVal;
|
|
78
|
+
};
|
|
79
|
+
return newInst;
|
|
80
|
+
}
|
|
81
|
+
cum_prod(reverse = false) {
|
|
82
|
+
const newInst = (0, ExprBase_1.derive)(this);
|
|
83
|
+
newInst.partitionOpsIndex = this.ops.length;
|
|
84
|
+
newInst.groupingOpsIndex = this.ops.length;
|
|
85
|
+
newInst.evaluateWindow = function (groupPreValues, _partitionIndices, currentIndex) {
|
|
86
|
+
let prod = 1;
|
|
87
|
+
let hasValid = false;
|
|
88
|
+
const start = reverse ? currentIndex : 0;
|
|
89
|
+
const end = reverse ? groupPreValues.length - 1 : currentIndex;
|
|
90
|
+
for (let i = start; i <= end; i++) {
|
|
91
|
+
const val = groupPreValues[i];
|
|
92
|
+
if (val != null) {
|
|
93
|
+
prod *= val;
|
|
94
|
+
hasValid = true;
|
|
95
|
+
}
|
|
96
|
+
}
|
|
97
|
+
return hasValid ? prod : null;
|
|
98
|
+
};
|
|
99
|
+
return newInst;
|
|
100
|
+
}
|
|
101
|
+
cum_sum(reverse = false) {
|
|
102
|
+
const newInst = (0, ExprBase_1.derive)(this);
|
|
103
|
+
newInst.partitionOpsIndex = this.ops.length;
|
|
104
|
+
newInst.groupingOpsIndex = this.ops.length;
|
|
105
|
+
newInst.evaluateWindow = function (groupPreValues, _partitionIndices, currentIndex) {
|
|
106
|
+
let sum = 0;
|
|
107
|
+
const start = reverse ? currentIndex : 0;
|
|
108
|
+
const end = reverse ? groupPreValues.length - 1 : currentIndex;
|
|
109
|
+
for (let i = start; i <= end; i++) {
|
|
110
|
+
const val = groupPreValues[i];
|
|
111
|
+
if (val != null)
|
|
112
|
+
sum += val;
|
|
113
|
+
}
|
|
114
|
+
return sum;
|
|
115
|
+
};
|
|
116
|
+
return newInst;
|
|
117
|
+
}
|
|
118
|
+
dense_rank() {
|
|
119
|
+
const newInst = (0, ExprBase_1.derive)(this);
|
|
120
|
+
newInst.partitionOpsIndex = this.ops.length;
|
|
121
|
+
newInst.groupingOpsIndex = this.ops.length;
|
|
122
|
+
newInst.evaluateWindow = function (groupPreValues, _partitionIndices, currentIndex) {
|
|
123
|
+
const sortedUnique = Array.from(new Set(groupPreValues)).sort((a, b) => a - b);
|
|
124
|
+
const valueToRank = new Map();
|
|
125
|
+
for (let idx = 0; idx < sortedUnique.length; idx++) {
|
|
126
|
+
valueToRank.set(sortedUnique[idx], idx + 1);
|
|
127
|
+
}
|
|
128
|
+
const currentVal = groupPreValues[currentIndex];
|
|
129
|
+
return valueToRank.get(currentVal) ?? null;
|
|
130
|
+
};
|
|
131
|
+
return newInst;
|
|
132
|
+
}
|
|
133
|
+
lag(offset = 1, defaultVal = null) {
|
|
134
|
+
const newInst = (0, ExprBase_1.derive)(this);
|
|
135
|
+
newInst.partitionOpsIndex = this.ops.length;
|
|
136
|
+
newInst.groupingOpsIndex = this.ops.length;
|
|
137
|
+
newInst.evaluateWindow = function (groupPreValues, _partitionIndices, currentIndex) {
|
|
138
|
+
let val = defaultVal;
|
|
139
|
+
if (currentIndex - offset >= 0) {
|
|
140
|
+
val = groupPreValues[currentIndex - offset];
|
|
141
|
+
}
|
|
142
|
+
return val;
|
|
143
|
+
};
|
|
144
|
+
return newInst;
|
|
145
|
+
}
|
|
146
|
+
lead(offset = 1, defaultVal = null) {
|
|
147
|
+
const newInst = (0, ExprBase_1.derive)(this);
|
|
148
|
+
newInst.partitionOpsIndex = this.ops.length;
|
|
149
|
+
newInst.groupingOpsIndex = this.ops.length;
|
|
150
|
+
newInst.evaluateWindow = function (groupPreValues, _partitionIndices, currentIndex) {
|
|
151
|
+
let val = defaultVal;
|
|
152
|
+
if (currentIndex + offset < groupPreValues.length) {
|
|
153
|
+
val = groupPreValues[currentIndex + offset];
|
|
154
|
+
}
|
|
155
|
+
return val;
|
|
156
|
+
};
|
|
157
|
+
return newInst;
|
|
158
|
+
}
|
|
159
|
+
over(columns) {
|
|
160
|
+
const newInst = (0, ExprBase_1.derive)(this);
|
|
161
|
+
const cols = Array.isArray(columns) ? columns : [columns];
|
|
162
|
+
newInst.partitionBy = cols;
|
|
163
|
+
return newInst;
|
|
164
|
+
}
|
|
165
|
+
rank() {
|
|
166
|
+
const newInst = (0, ExprBase_1.derive)(this);
|
|
167
|
+
newInst.partitionOpsIndex = this.ops.length;
|
|
168
|
+
newInst.groupingOpsIndex = this.ops.length;
|
|
169
|
+
newInst.evaluateWindow = function (groupPreValues, _partitionIndices, currentIndex) {
|
|
170
|
+
const sorted = [...groupPreValues].sort((a, b) => a - b);
|
|
171
|
+
const valueToRank = new Map();
|
|
172
|
+
for (let i = 0; i < sorted.length; i++) {
|
|
173
|
+
const v = sorted[i];
|
|
174
|
+
if (!valueToRank.has(v)) {
|
|
175
|
+
valueToRank.set(v, i + 1);
|
|
176
|
+
}
|
|
177
|
+
}
|
|
178
|
+
const currentVal = groupPreValues[currentIndex];
|
|
179
|
+
return valueToRank.get(currentVal) ?? null;
|
|
180
|
+
};
|
|
181
|
+
return newInst;
|
|
182
|
+
}
|
|
183
|
+
rolling_max(windowSize) {
|
|
184
|
+
return this._rolling(windowSize, v => (0, utils_1.getListStats)(v).max);
|
|
185
|
+
}
|
|
186
|
+
rolling_mean(windowSize) {
|
|
187
|
+
return this._rolling(windowSize, v => (0, utils_1.getListStats)(v).mean);
|
|
188
|
+
}
|
|
189
|
+
rolling_median(windowSize) {
|
|
190
|
+
return this._rolling(windowSize, v => {
|
|
191
|
+
if (!(0, utils_1.isArrayOfType)(v, "number", { allowNulls: true }))
|
|
192
|
+
return null;
|
|
193
|
+
const len = v.length;
|
|
194
|
+
const nums = [];
|
|
195
|
+
for (let i = 0; i < len; i++) {
|
|
196
|
+
const val = v[i];
|
|
197
|
+
if (val != null) {
|
|
198
|
+
nums.push(val);
|
|
199
|
+
}
|
|
200
|
+
}
|
|
201
|
+
const numsLen = nums.length;
|
|
202
|
+
if (numsLen === 0)
|
|
203
|
+
return null;
|
|
204
|
+
nums.sort((a, b) => a - b);
|
|
205
|
+
const mid = Math.floor(numsLen / 2);
|
|
206
|
+
return numsLen % 2 !== 0
|
|
207
|
+
? nums[mid]
|
|
208
|
+
: (nums[mid - 1] + nums[mid]) / 2;
|
|
209
|
+
});
|
|
210
|
+
}
|
|
211
|
+
rolling_min(windowSize) {
|
|
212
|
+
return this._rolling(windowSize, v => (0, utils_1.getListStats)(v).min);
|
|
213
|
+
}
|
|
214
|
+
rolling_quantile(quantile, windowSize) {
|
|
215
|
+
return this._rolling(windowSize, v => {
|
|
216
|
+
const f = [];
|
|
217
|
+
for (let i = 0; i < v.length; i++) {
|
|
218
|
+
if (v[i] != null)
|
|
219
|
+
f.push(v[i]);
|
|
220
|
+
}
|
|
221
|
+
const n = f.length;
|
|
222
|
+
if (n === 0)
|
|
223
|
+
return null;
|
|
224
|
+
f.sort((a, b) => a - b);
|
|
225
|
+
const idx = quantile * (n - 1);
|
|
226
|
+
const low = Math.floor(idx);
|
|
227
|
+
const high = Math.ceil(idx);
|
|
228
|
+
if (low === high)
|
|
229
|
+
return f[low];
|
|
230
|
+
return f[low] + (idx - low) * (f[high] - f[low]);
|
|
231
|
+
});
|
|
232
|
+
}
|
|
233
|
+
rolling_rank(windowSize) {
|
|
234
|
+
const newInst = (0, ExprBase_1.derive)(this);
|
|
235
|
+
newInst.partitionOpsIndex = this.ops.length;
|
|
236
|
+
newInst.groupingOpsIndex = this.ops.length;
|
|
237
|
+
newInst.evaluateWindow = function (groupPreValues, _partitionIndices, currentIndex) {
|
|
238
|
+
const start = Math.max(0, currentIndex - windowSize + 1);
|
|
239
|
+
const end = currentIndex + 1;
|
|
240
|
+
const vals = groupPreValues.slice(start, end);
|
|
241
|
+
const currentVal = groupPreValues[currentIndex];
|
|
242
|
+
if (currentVal == null)
|
|
243
|
+
return null;
|
|
244
|
+
const nonNullVals = [];
|
|
245
|
+
for (let j = 0; j < vals.length; j++) {
|
|
246
|
+
if (vals[j] != null)
|
|
247
|
+
nonNullVals.push(vals[j]);
|
|
248
|
+
}
|
|
249
|
+
if (nonNullVals.length === 0)
|
|
250
|
+
return null;
|
|
251
|
+
const sorted = [...nonNullVals].sort((a, b) => a - b);
|
|
252
|
+
const valueToRank = new Map();
|
|
253
|
+
for (let i = 0; i < sorted.length; i++) {
|
|
254
|
+
const v = sorted[i];
|
|
255
|
+
if (!valueToRank.has(v)) {
|
|
256
|
+
valueToRank.set(v, i + 1);
|
|
257
|
+
}
|
|
258
|
+
}
|
|
259
|
+
return valueToRank.get(currentVal) ?? null;
|
|
260
|
+
};
|
|
261
|
+
return newInst;
|
|
262
|
+
}
|
|
263
|
+
rolling_std(windowSize) {
|
|
264
|
+
return this._rolling(windowSize, v => (0, utils_1.getListStats)(v).std);
|
|
265
|
+
}
|
|
266
|
+
rolling_sum(windowSize) {
|
|
267
|
+
return this._rolling(windowSize, v => (0, utils_1.getListStats)(v).sum);
|
|
268
|
+
}
|
|
269
|
+
row_number() {
|
|
270
|
+
const newInst = (0, ExprBase_1.derive)(this);
|
|
271
|
+
newInst.partitionOpsIndex = this.ops.length;
|
|
272
|
+
newInst.groupingOpsIndex = this.ops.length;
|
|
273
|
+
newInst.evaluateWindow = function (_groupPreValues, _partitionIndices, currentIndex) {
|
|
274
|
+
return currentIndex + 1;
|
|
275
|
+
};
|
|
276
|
+
newInst.outputName = "row_number";
|
|
277
|
+
return newInst;
|
|
278
|
+
}
|
|
279
|
+
};
|
|
280
|
+
};
|
|
281
|
+
exports.WindowExpr = WindowExpr;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const KEY_SEPARATOR = "\0";
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import { GroupedData } from "./grouped/grouped";
|
|
2
|
+
import type { IExpr, ColumnDict, DataFrameColumns, ConcatOptions, ConcatItem, HorizontalConcatOptions, RowRecord } from "../types";
|
|
3
|
+
import type { LimitOptions, SortOptions, PivotOptions, JoinOptions, UnpivotOptions } from "./types";
|
|
4
|
+
import { DataType } from "../datatypes";
|
|
5
|
+
export declare class DataFrame<T extends RowRecord = any> {
|
|
6
|
+
_columns: DataFrameColumns<T>;
|
|
7
|
+
private _height;
|
|
8
|
+
private _schema;
|
|
9
|
+
constructor(data: T[] | ColumnDict, schema?: Record<string, DataType>, height?: number);
|
|
10
|
+
private inferSchema;
|
|
11
|
+
private applySchema;
|
|
12
|
+
getSchema(): Record<string, DataType>;
|
|
13
|
+
to_dicts(): T[];
|
|
14
|
+
to_dict(): DataFrameColumns<T>;
|
|
15
|
+
get columns(): string[];
|
|
16
|
+
concat<U extends RowRecord = any>(items: ConcatItem | ConcatItem[], options?: ConcatOptions): DataFrame<U>;
|
|
17
|
+
drop<K extends keyof T>(...args: (K | K[])[]): DataFrame<Omit<T, K>>;
|
|
18
|
+
get dtypes(): DataType[];
|
|
19
|
+
filter(...exprs: (IExpr | ((row: T) => any))[]): DataFrame<T>;
|
|
20
|
+
groupby<K extends keyof T>(keys: K | K[]): GroupedData<T, K>;
|
|
21
|
+
head(n?: number): DataFrame<T>;
|
|
22
|
+
get height(): number;
|
|
23
|
+
hstack<U extends RowRecord = any>(other: ConcatItem | ConcatItem[], options?: HorizontalConcatOptions): DataFrame<U>;
|
|
24
|
+
join<U extends RowRecord = any, R extends RowRecord = any>(config: JoinOptions<T, U>): DataFrame<R>;
|
|
25
|
+
limit(n: number, options?: LimitOptions): DataFrame<T>;
|
|
26
|
+
pivot<U extends RowRecord = any>(config: PivotOptions<T>): DataFrame<U>;
|
|
27
|
+
rename(mapping?: Partial<Record<keyof T, string>>): DataFrame<any>;
|
|
28
|
+
reverse(): DataFrame<T>;
|
|
29
|
+
get schema(): Record<string, DataType>;
|
|
30
|
+
select<U extends RowRecord = any>(...args: (string | IExpr | Record<string, any> | (string | IExpr | Record<string, any>)[])[]): DataFrame<U>;
|
|
31
|
+
get shape(): [number, number];
|
|
32
|
+
slice(start: number, end?: number): DataFrame<T>;
|
|
33
|
+
sort(config?: SortOptions<T>): DataFrame<T>;
|
|
34
|
+
tail(n?: number): DataFrame<T>;
|
|
35
|
+
to_list<K extends keyof T>(nameOrExpr: K | IExpr): any[];
|
|
36
|
+
unique<K extends keyof T>(columns?: K | K[]): DataFrame<T>;
|
|
37
|
+
unpivot<U extends RowRecord = any>(config: UnpivotOptions<T>): DataFrame<U>;
|
|
38
|
+
vstack<U extends RowRecord = any>(other: ConcatItem | ConcatItem[]): DataFrame<U>;
|
|
39
|
+
get width(): number;
|
|
40
|
+
private _normalizeArgs;
|
|
41
|
+
with_columns(...args: (string | IExpr | Record<string, any> | (string | IExpr | Record<string, any>)[])[]): DataFrame<any>;
|
|
42
|
+
}
|