@ohos-ports/nodejs-polars 0.23.4-beta.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +19 -0
- package/README.md +217 -0
- package/bin/cfg.d.ts +156 -0
- package/bin/cfg.js +52 -0
- package/bin/dataframe.d.ts +2135 -0
- package/bin/dataframe.js +783 -0
- package/bin/datatypes/conversion.d.ts +2 -0
- package/bin/datatypes/conversion.js +2 -0
- package/bin/datatypes/datatype.d.ts +285 -0
- package/bin/datatypes/datatype.js +430 -0
- package/bin/datatypes/field.d.ts +26 -0
- package/bin/datatypes/field.js +36 -0
- package/bin/datatypes/index.d.ts +43 -0
- package/bin/datatypes/index.js +120 -0
- package/bin/error.d.ts +7 -0
- package/bin/error.js +17 -0
- package/bin/functions.d.ts +26 -0
- package/bin/functions.js +208 -0
- package/bin/groupby.d.ts +212 -0
- package/bin/groupby.js +156 -0
- package/bin/html.d.ts +4 -0
- package/bin/html.js +18 -0
- package/bin/index.d.ts +256 -0
- package/bin/index.js +267 -0
- package/bin/internals/construction.d.ts +7 -0
- package/bin/internals/construction.js +256 -0
- package/bin/internals/polars_internal.d.ts +2 -0
- package/bin/internals/polars_internal.js +7 -0
- package/bin/io.d.ts +433 -0
- package/bin/io.js +344 -0
- package/bin/lazy/dataframe.d.ts +785 -0
- package/bin/lazy/dataframe.js +427 -0
- package/bin/lazy/expr/datetime.d.ts +8 -0
- package/bin/lazy/expr/datetime.js +27 -0
- package/bin/lazy/expr/index.d.ts +1152 -0
- package/bin/lazy/expr/index.js +632 -0
- package/bin/lazy/expr/list.d.ts +8 -0
- package/bin/lazy/expr/list.js +115 -0
- package/bin/lazy/expr/string.d.ts +534 -0
- package/bin/lazy/expr/string.js +131 -0
- package/bin/lazy/expr/struct.d.ts +126 -0
- package/bin/lazy/expr/struct.js +26 -0
- package/bin/lazy/functions.d.ts +612 -0
- package/bin/lazy/functions.js +687 -0
- package/bin/lazy/groupby.d.ts +29 -0
- package/bin/lazy/groupby.js +30 -0
- package/bin/lazy/index.d.ts +4 -0
- package/bin/lazy/index.js +20 -0
- package/bin/lazy/whenthen.d.ts +67 -0
- package/bin/lazy/whenthen.js +81 -0
- package/bin/native-polars.d.ts +2 -0
- package/bin/native-polars.js +267 -0
- package/bin/series/datetime.d.ts +8 -0
- package/bin/series/datetime.js +34 -0
- package/bin/series/index.d.ts +1135 -0
- package/bin/series/index.js +700 -0
- package/bin/series/list.d.ts +8 -0
- package/bin/series/list.js +87 -0
- package/bin/series/string.d.ts +300 -0
- package/bin/series/string.js +125 -0
- package/bin/series/struct.d.ts +36 -0
- package/bin/series/struct.js +35 -0
- package/bin/shared_traits.d.ts +1458 -0
- package/bin/shared_traits.js +2 -0
- package/bin/sql.d.ts +244 -0
- package/bin/sql.js +63 -0
- package/bin/types.d.ts +287 -0
- package/bin/types.js +2 -0
- package/bin/utils.d.ts +38 -0
- package/bin/utils.js +69 -0
- package/package.json +45 -0
|
@@ -0,0 +1,285 @@
|
|
|
1
|
+
import { Field } from "./field";
|
|
2
|
+
export declare abstract class DataType<Dtype extends DataTypeName = any> {
|
|
3
|
+
readonly __dtype: Dtype;
|
|
4
|
+
abstract readonly variant: DataTypeName;
|
|
5
|
+
protected identity: string;
|
|
6
|
+
protected get inner(): null | any[];
|
|
7
|
+
equals(other: DataType): boolean;
|
|
8
|
+
/** Null type */
|
|
9
|
+
static get Null(): Null;
|
|
10
|
+
/** `true` and `false`. */
|
|
11
|
+
static get Bool(): Bool;
|
|
12
|
+
/** An `i8` */
|
|
13
|
+
static get Int8(): Int8;
|
|
14
|
+
/** An `i16` */
|
|
15
|
+
static get Int16(): Int16;
|
|
16
|
+
/** An `i32` */
|
|
17
|
+
static get Int32(): Int32;
|
|
18
|
+
/** An `i64` */
|
|
19
|
+
static get Int64(): Int64;
|
|
20
|
+
/** An `u8` */
|
|
21
|
+
static get UInt8(): UInt8;
|
|
22
|
+
/** An `u16` */
|
|
23
|
+
static get UInt16(): UInt16;
|
|
24
|
+
/** An `u32` */
|
|
25
|
+
static get UInt32(): UInt32;
|
|
26
|
+
/** An `u64` */
|
|
27
|
+
static get UInt64(): UInt64;
|
|
28
|
+
/** A `f32` */
|
|
29
|
+
static get Float32(): Float32;
|
|
30
|
+
/** A `f64` */
|
|
31
|
+
static get Float64(): Float64;
|
|
32
|
+
static get Date(): Date;
|
|
33
|
+
/** Time of day type */
|
|
34
|
+
static get Time(): Time;
|
|
35
|
+
/** Type for wrapping arbitrary JS objects */
|
|
36
|
+
static get Object(): Object_;
|
|
37
|
+
/** A categorical encoding of a set of strings */
|
|
38
|
+
static get Categorical(): Categorical;
|
|
39
|
+
/** Decimal type */
|
|
40
|
+
static Decimal(precision?: number, scale?: number): Decimal;
|
|
41
|
+
/**
|
|
42
|
+
* Calendar date and time type
|
|
43
|
+
* @param timeUnit any of 'ms' | 'ns' | 'us'
|
|
44
|
+
* @param timeZone timezone string as defined by Intl.DateTimeFormat `America/New_York` for example.
|
|
45
|
+
*/
|
|
46
|
+
static Datetime(timeUnit?: TimeUnit | "ms" | "ns" | "us", timeZone?: string | null | undefined): Datetime;
|
|
47
|
+
static Duration(timeUnit: TimeUnit | "ms" | "ns" | "us"): Duration;
|
|
48
|
+
/**
|
|
49
|
+
* Nested list/array type
|
|
50
|
+
*
|
|
51
|
+
* @param inner The `DataType` of values within the list
|
|
52
|
+
*
|
|
53
|
+
*/
|
|
54
|
+
static List(inner: DataType): List;
|
|
55
|
+
/**
|
|
56
|
+
* List of fixed length
|
|
57
|
+
* This is called `Array` in other polars implementations, but `Array` is widely used in JS, so we use `FixedSizeList` instead.
|
|
58
|
+
*
|
|
59
|
+
*/
|
|
60
|
+
static FixedSizeList(inner: DataType, listSize: number): FixedSizeList;
|
|
61
|
+
/**
|
|
62
|
+
* Struct type
|
|
63
|
+
*/
|
|
64
|
+
static Struct(fields: Field[]): DataType;
|
|
65
|
+
static Struct(fields: {
|
|
66
|
+
[key: string]: DataType;
|
|
67
|
+
}): DataType;
|
|
68
|
+
/** A variable-length UTF-8 encoded string whose offsets are represented as `i64`. */
|
|
69
|
+
static get Utf8(): Utf8;
|
|
70
|
+
static get String(): String;
|
|
71
|
+
toString(): string;
|
|
72
|
+
toJSON(): {
|
|
73
|
+
[x: string]: {
|
|
74
|
+
[x: string]: any;
|
|
75
|
+
};
|
|
76
|
+
} | {
|
|
77
|
+
[x: string]: DataTypeName;
|
|
78
|
+
};
|
|
79
|
+
asFixedSizeList(): (this & FixedSizeList) | null;
|
|
80
|
+
}
|
|
81
|
+
export declare class Null extends DataType<"Null"> {
|
|
82
|
+
__dtype: "Null";
|
|
83
|
+
readonly variant = "Null";
|
|
84
|
+
}
|
|
85
|
+
export declare class Bool extends DataType<"Bool"> {
|
|
86
|
+
__dtype: "Bool";
|
|
87
|
+
readonly variant = "Bool";
|
|
88
|
+
}
|
|
89
|
+
export declare class Int8 extends DataType<"Int8"> {
|
|
90
|
+
__dtype: "Int8";
|
|
91
|
+
readonly variant = "Int8";
|
|
92
|
+
}
|
|
93
|
+
export declare class Int16 extends DataType<"Int16"> {
|
|
94
|
+
__dtype: "Int16";
|
|
95
|
+
readonly variant = "Int16";
|
|
96
|
+
}
|
|
97
|
+
export declare class Int32 extends DataType<"Int32"> {
|
|
98
|
+
__dtype: "Int32";
|
|
99
|
+
readonly variant = "Int32";
|
|
100
|
+
}
|
|
101
|
+
export declare class Int64 extends DataType<"Int64"> {
|
|
102
|
+
__dtype: "Int64";
|
|
103
|
+
readonly variant = "Int64";
|
|
104
|
+
}
|
|
105
|
+
export declare class UInt8 extends DataType<"UInt8"> {
|
|
106
|
+
__dtype: "UInt8";
|
|
107
|
+
readonly variant = "UInt8";
|
|
108
|
+
}
|
|
109
|
+
export declare class UInt16 extends DataType<"UInt16"> {
|
|
110
|
+
__dtype: "UInt16";
|
|
111
|
+
readonly variant = "UInt16";
|
|
112
|
+
}
|
|
113
|
+
export declare class UInt32 extends DataType<"UInt32"> {
|
|
114
|
+
__dtype: "UInt32";
|
|
115
|
+
readonly variant = "UInt32";
|
|
116
|
+
}
|
|
117
|
+
export declare class UInt64 extends DataType<"UInt64"> {
|
|
118
|
+
__dtype: "UInt64";
|
|
119
|
+
readonly variant = "UInt64";
|
|
120
|
+
}
|
|
121
|
+
export declare class Float32 extends DataType<"Float32"> {
|
|
122
|
+
__dtype: "Float32";
|
|
123
|
+
readonly variant = "Float32";
|
|
124
|
+
}
|
|
125
|
+
export declare class Float64 extends DataType<"Float64"> {
|
|
126
|
+
__dtype: "Float64";
|
|
127
|
+
readonly variant = "Float64";
|
|
128
|
+
}
|
|
129
|
+
export declare class Date extends DataType<"Date"> {
|
|
130
|
+
__dtype: "Date";
|
|
131
|
+
readonly variant = "Date";
|
|
132
|
+
}
|
|
133
|
+
export declare class Time extends DataType<"Time"> {
|
|
134
|
+
__dtype: "Time";
|
|
135
|
+
readonly variant = "Time";
|
|
136
|
+
}
|
|
137
|
+
export declare class Object_ extends DataType<"Object"> {
|
|
138
|
+
__dtype: "Object";
|
|
139
|
+
readonly variant = "Object";
|
|
140
|
+
}
|
|
141
|
+
export declare class Utf8 extends DataType<"Utf8"> {
|
|
142
|
+
__dtype: "Utf8";
|
|
143
|
+
readonly variant = "Utf8";
|
|
144
|
+
}
|
|
145
|
+
export declare class String extends DataType<"String"> {
|
|
146
|
+
__dtype: "String";
|
|
147
|
+
readonly variant = "String";
|
|
148
|
+
}
|
|
149
|
+
export declare class Categorical extends DataType<"Categorical"> {
|
|
150
|
+
__dtype: "Categorical";
|
|
151
|
+
readonly variant = "Categorical";
|
|
152
|
+
}
|
|
153
|
+
export declare class Decimal extends DataType<"Decimal"> {
|
|
154
|
+
__dtype: "Decimal";
|
|
155
|
+
readonly variant = "Decimal";
|
|
156
|
+
private precision;
|
|
157
|
+
private scale;
|
|
158
|
+
constructor(precision?: number, scale?: number);
|
|
159
|
+
get inner(): (number | null)[];
|
|
160
|
+
equals(other: DataType): boolean;
|
|
161
|
+
toJSON(): {
|
|
162
|
+
[x: string]: {
|
|
163
|
+
Decimal: {
|
|
164
|
+
precision: number | null;
|
|
165
|
+
scale: number | null;
|
|
166
|
+
};
|
|
167
|
+
};
|
|
168
|
+
};
|
|
169
|
+
}
|
|
170
|
+
/**
|
|
171
|
+
* Datetime type
|
|
172
|
+
*/
|
|
173
|
+
export declare class Datetime extends DataType<"Datetime"> {
|
|
174
|
+
private timeUnit;
|
|
175
|
+
private timeZone?;
|
|
176
|
+
__dtype: "Datetime";
|
|
177
|
+
readonly variant = "Datetime";
|
|
178
|
+
constructor(timeUnit?: TimeUnit | "ms" | "ns" | "us", timeZone?: string | null | undefined);
|
|
179
|
+
get inner(): (string | null | undefined)[];
|
|
180
|
+
equals(other: DataType): boolean;
|
|
181
|
+
}
|
|
182
|
+
export declare class Duration extends DataType<"Duration"> {
|
|
183
|
+
private timeUnit;
|
|
184
|
+
__dtype: "Duration";
|
|
185
|
+
readonly variant = "Duration";
|
|
186
|
+
constructor(timeUnit?: TimeUnit | "ms" | "ns" | "us");
|
|
187
|
+
get inner(): (TimeUnit | "ms" | "ns" | "us")[];
|
|
188
|
+
equals(other: Duration): boolean;
|
|
189
|
+
}
|
|
190
|
+
export declare class List extends DataType<"List"> {
|
|
191
|
+
protected __inner: DataType;
|
|
192
|
+
__dtype: "List";
|
|
193
|
+
readonly variant = "List";
|
|
194
|
+
constructor(__inner: DataType);
|
|
195
|
+
get inner(): DataType<any>[];
|
|
196
|
+
equals(other: DataType): boolean;
|
|
197
|
+
}
|
|
198
|
+
export declare class FixedSizeList extends DataType<"FixedSizeList"> {
|
|
199
|
+
protected __inner: DataType;
|
|
200
|
+
protected listSize: number;
|
|
201
|
+
__dtype: "FixedSizeList";
|
|
202
|
+
readonly variant = "FixedSizeList";
|
|
203
|
+
constructor(__inner: DataType, listSize: number);
|
|
204
|
+
get inner(): [DataType, number];
|
|
205
|
+
equals(other: DataType): boolean;
|
|
206
|
+
toJSON(): {
|
|
207
|
+
[x: string]: {
|
|
208
|
+
FixedSizeList: {
|
|
209
|
+
type: {
|
|
210
|
+
[x: string]: {
|
|
211
|
+
[x: string]: any;
|
|
212
|
+
};
|
|
213
|
+
} | {
|
|
214
|
+
[x: string]: DataTypeName;
|
|
215
|
+
};
|
|
216
|
+
size: number;
|
|
217
|
+
};
|
|
218
|
+
};
|
|
219
|
+
};
|
|
220
|
+
}
|
|
221
|
+
export declare class Struct extends DataType<"Struct"> {
|
|
222
|
+
__dtype: "Struct";
|
|
223
|
+
readonly variant = "Struct";
|
|
224
|
+
private fields;
|
|
225
|
+
constructor(inner: {
|
|
226
|
+
[name: string]: DataType;
|
|
227
|
+
} | Field[]);
|
|
228
|
+
get inner(): Field[];
|
|
229
|
+
equals(other: DataType): boolean;
|
|
230
|
+
toJSON(): any;
|
|
231
|
+
}
|
|
232
|
+
/**
|
|
233
|
+
* Datetime time unit
|
|
234
|
+
*/
|
|
235
|
+
export declare enum TimeUnit {
|
|
236
|
+
Nanoseconds = "ns",
|
|
237
|
+
Microseconds = "us",
|
|
238
|
+
Milliseconds = "ms"
|
|
239
|
+
}
|
|
240
|
+
/**
|
|
241
|
+
* @ignore
|
|
242
|
+
* Timeunit namespace
|
|
243
|
+
*/
|
|
244
|
+
export declare namespace TimeUnit {
|
|
245
|
+
function from(s: "ms" | "ns" | "us"): TimeUnit;
|
|
246
|
+
}
|
|
247
|
+
/**
|
|
248
|
+
* Datatype namespace
|
|
249
|
+
*/
|
|
250
|
+
export declare namespace DataType {
|
|
251
|
+
type Categorical = import(".").Categorical;
|
|
252
|
+
type Int8 = import(".").Int8;
|
|
253
|
+
type Int16 = import(".").Int16;
|
|
254
|
+
type Int32 = import(".").Int32;
|
|
255
|
+
type Int64 = import(".").Int64;
|
|
256
|
+
type UInt8 = import(".").UInt8;
|
|
257
|
+
type UInt16 = import(".").UInt16;
|
|
258
|
+
type UInt32 = import(".").UInt32;
|
|
259
|
+
type UInt64 = import(".").UInt64;
|
|
260
|
+
type Float32 = import(".").Float32;
|
|
261
|
+
type Float64 = import(".").Float64;
|
|
262
|
+
type Bool = import(".").Bool;
|
|
263
|
+
type Utf8 = import(".").Utf8;
|
|
264
|
+
type String = import(".").String;
|
|
265
|
+
type List = import(".").List;
|
|
266
|
+
type FixedSizeList = import(".").FixedSizeList;
|
|
267
|
+
type Date = import(".").Date;
|
|
268
|
+
type Datetime = import(".").Datetime;
|
|
269
|
+
type Time = import(".").Time;
|
|
270
|
+
type Duration = import(".").Duration;
|
|
271
|
+
type Object = import(".").Object_;
|
|
272
|
+
type Null = import(".").Null;
|
|
273
|
+
type Struct = import(".").Struct;
|
|
274
|
+
type Decimal = import(".").Decimal;
|
|
275
|
+
/**
|
|
276
|
+
* deserializes a datatype from the serde output of rust polars `DataType`
|
|
277
|
+
* @param dtype dtype object
|
|
278
|
+
*/
|
|
279
|
+
function deserialize(dtype: any): DataType;
|
|
280
|
+
}
|
|
281
|
+
export type DataTypeName = "Null" | "Bool" | "Int8" | "Int16" | "Int32" | "Int64" | "UInt8" | "UInt16" | "UInt32" | "UInt64" | "Float32" | "Float64" | "Decimal" | "Date" | "Datetime" | "Time" | "Duration" | "Object" | "Utf8" | "String" | "Categorical" | "List" | "FixedSizeList" | "Struct";
|
|
282
|
+
export type JsType = number | boolean | string;
|
|
283
|
+
export type DTypeToJs<T> = T extends DataType.Decimal ? bigint : T extends DataType.Float64 ? number : T extends DataType.Float32 ? number : T extends DataType.Int64 ? bigint : T extends DataType.Int32 ? number : T extends DataType.Int16 ? number : T extends DataType.Int8 ? number : T extends DataType.Bool ? boolean : T extends DataType.Utf8 ? string : T extends DataType.String ? string : never;
|
|
284
|
+
export type DTypeToJsLoose<T> = T extends DataType.Decimal ? number | bigint : T extends DataType.Float64 ? number | bigint : T extends DataType.Float32 ? number | bigint : T extends DataType.Int64 ? number | bigint : T extends DataType.Int32 ? number | bigint : T extends DataType.Int16 ? number | bigint : T extends DataType.Int8 ? number | bigint : T extends DataType.Bool ? boolean : T extends DataType.Utf8 ? string : T extends DataType.String ? string : never;
|
|
285
|
+
export type DtypeToJsName<T> = T extends DataType.Decimal ? "Decimal" : T extends DataType.Float64 ? "Float64" : T extends DataType.Float32 ? "Float32" : T extends DataType.Int64 ? "Int64" : T extends DataType.Int32 ? "Int32" : T extends DataType.Int16 ? "Int16" : T extends DataType.Int8 ? "Int8" : T extends DataType.UInt64 ? "UInt64" : T extends DataType.UInt32 ? "UInt32" : T extends DataType.UInt16 ? "UInt16" : T extends DataType.UInt8 ? "UInt8" : T extends DataType.Bool ? "Bool" : T extends DataType.Utf8 ? "Utf8" : never;
|