1
1
import * as series from "./series" ;
2
2
import * as df from "./dataframe" ;
3
3
import { DataType , Field as _field } from "./datatypes" ;
4
+ export { DataType } from "./datatypes" ;
4
5
import * as func from "./functions" ;
5
6
import * as io from "./io" ;
6
7
import * as cfg from "./cfg" ;
7
8
import * as ldf from "./lazy/dataframe" ;
8
9
import pli from "./internals/polars_internal" ;
9
- export { DataType , Field , TimeUnit } from "./datatypes" ;
10
10
export * from "./series" ;
11
- export { Expr } from "./lazy/expr" ;
12
11
export * from "./dataframe" ;
13
12
export * from "./functions" ;
14
13
export * from "./io" ;
@@ -18,9 +17,8 @@ export * from "./lazy";
18
17
import * as lazy from "./lazy" ;
19
18
export * from "./types" ;
20
19
import * as sql from "./sql" ;
21
- export type { SQLContext } from "./sql" ;
22
-
23
20
export type { GroupBy } from "./groupby" ;
21
+
24
22
export namespace pl {
25
23
export import Expr = lazy . Expr ;
26
24
export import DataFrame = df . DataFrame ;
@@ -32,29 +30,6 @@ export namespace pl {
32
30
export type ChainedWhen = lazy . ChainedWhen ;
33
31
export type ChainedThen = lazy . ChainedThen ;
34
32
export import Config = cfg . Config ;
35
- export import Int8 = DataType . Int8 ;
36
- export import Int16 = DataType . Int16 ;
37
- export import Int32 = DataType . Int32 ;
38
- export import Int64 = DataType . Int64 ;
39
- export import UInt8 = DataType . UInt8 ;
40
- export import UInt16 = DataType . UInt16 ;
41
- export import UInt32 = DataType . UInt32 ;
42
- export import UInt64 = DataType . UInt64 ;
43
- export import Float32 = DataType . Float32 ;
44
- export import Float64 = DataType . Float64 ;
45
- export import Bool = DataType . Bool ;
46
- export import Utf8 = DataType . Utf8 ;
47
- // biome-ignore lint/suspicious/noShadowRestrictedNames: pl.String
48
- export import String = DataType . String ;
49
- export import List = DataType . List ;
50
- // biome-ignore lint/suspicious/noShadowRestrictedNames: pl.Date
51
- export import Date = DataType . Date ;
52
- export import Datetime = DataType . Datetime ;
53
- export import Time = DataType . Time ;
54
- // biome-ignore lint/suspicious/noShadowRestrictedNames: pl.Object
55
- export import Object = DataType . Object ;
56
- export import Null = DataType . Null ;
57
- export import Struct = DataType . Struct ;
58
33
export import Categorical = DataType . Categorical ;
59
34
export import Field = _field ;
60
35
export import repeat = func . repeat ;
@@ -113,6 +88,30 @@ export namespace pl {
113
88
export import when = lazy . when ;
114
89
export const version = pli . version ( ) ;
115
90
91
+ export import Int8 = DataType . Int8 ;
92
+ export import Int16 = DataType . Int16 ;
93
+ export import Int32 = DataType . Int32 ;
94
+ export import Int64 = DataType . Int64 ;
95
+ export import UInt8 = DataType . UInt8 ;
96
+ export import UInt16 = DataType . UInt16 ;
97
+ export import UInt32 = DataType . UInt32 ;
98
+ export import UInt64 = DataType . UInt64 ;
99
+ export import Float32 = DataType . Float32 ;
100
+ export import Float64 = DataType . Float64 ;
101
+ export import Bool = DataType . Bool ;
102
+ export import Utf8 = DataType . Utf8 ;
103
+ // biome-ignore lint/suspicious/noShadowRestrictedNames: pl.String
104
+ export import String = DataType . String ;
105
+ export import List = DataType . List ;
106
+ // biome-ignore lint/suspicious/noShadowRestrictedNames: pl.Date
107
+ export import Date = DataType . Date ;
108
+ export import Datetime = DataType . Datetime ;
109
+ export import Time = DataType . Time ;
110
+ // biome-ignore lint/suspicious/noShadowRestrictedNames: pl.Object
111
+ export import Object = DataType . Object ;
112
+ export import Null = DataType . Null ;
113
+ export import Struct = DataType . Struct ;
114
+
116
115
/**
117
116
* Run SQL queries against DataFrame/LazyFrame data.
118
117
*
@@ -126,5 +125,119 @@ export namespace pl {
126
125
return new sql . SQLContext ( frames ) ;
127
126
}
128
127
}
129
- // eslint-disable-next-line no-undef
128
+
130
129
export default pl ;
130
+
131
+ // ------
132
+ // CommonJS compatibility.
133
+ // This allows the user to use any of the following
134
+ // `import * as pl from "nodejs-polars"`
135
+ // `import pl from "nodejs-polars"`.
136
+ // `const pl = require("nodejs-polars")`.
137
+ // `const { DataFrame, Series, } = require("nodejs-polars")`.
138
+ // ------
139
+
140
+ export import Expr = lazy . Expr ;
141
+ export import DataFrame = df . DataFrame ;
142
+ export import LazyDataFrame = ldf . LazyDataFrame ;
143
+ export import Series = series . Series ;
144
+ export type LazyGroupBy = lazy . LazyGroupBy ;
145
+ export type When = lazy . When ;
146
+ export type Then = lazy . Then ;
147
+ export type ChainedWhen = lazy . ChainedWhen ;
148
+ export type ChainedThen = lazy . ChainedThen ;
149
+ export import Config = cfg . Config ;
150
+ export import Categorical = DataType . Categorical ;
151
+ export import Field = _field ;
152
+ export import repeat = func . repeat ;
153
+ export import concat = func . concat ;
154
+
155
+ // IO
156
+ export import scanCSV = io . scanCSV ;
157
+ export import scanJson = io . scanJson ;
158
+ export import scanIPC = io . scanIPC ;
159
+ export import scanParquet = io . scanParquet ;
160
+
161
+ export import readRecords = io . readRecords ;
162
+ export import readCSV = io . readCSV ;
163
+ export import readIPC = io . readIPC ;
164
+ export import readJSON = io . readJSON ;
165
+ export import readParquet = io . readParquet ;
166
+ export import readAvro = io . readAvro ;
167
+
168
+ export import readCSVStream = io . readCSVStream ;
169
+ export import readJSONStream = io . readJSONStream ;
170
+
171
+ // lazy
172
+ export import col = lazy . col ;
173
+ export import cols = lazy . cols ;
174
+ export import lit = lazy . lit ;
175
+ export import intRange = lazy . intRange ;
176
+ export import intRanges = lazy . intRanges ;
177
+ export import argSortBy = lazy . argSortBy ;
178
+ export import avg = lazy . avg ;
179
+ export import concatList = lazy . concatList ;
180
+ export import concatString = lazy . concatString ;
181
+ export import count = lazy . count ;
182
+ export import cov = lazy . cov ;
183
+ export import exclude = lazy . exclude ;
184
+ export import element = lazy . element ;
185
+ export import first = lazy . first ;
186
+ export import format = lazy . format ;
187
+ export import groups = lazy . groups ;
188
+ export import head = lazy . head ;
189
+ export import last = lazy . last ;
190
+ export import mean = lazy . mean ;
191
+ export import median = lazy . median ;
192
+ export import nUnique = lazy . nUnique ;
193
+ export import pearsonCorr = lazy . pearsonCorr ;
194
+ export import quantile = lazy . quantile ;
195
+ export import select = lazy . select ;
196
+ export import struct = lazy . struct ;
197
+ export import allHorizontal = lazy . allHorizontal ;
198
+ export import anyHorizontal = lazy . anyHorizontal ;
199
+ export import minHorizontal = lazy . minHorizontal ;
200
+ export import maxHorizontal = lazy . maxHorizontal ;
201
+ export import sumHorizontal = lazy . sumHorizontal ;
202
+ export import spearmanRankCorr = lazy . spearmanRankCorr ;
203
+ export import tail = lazy . tail ;
204
+ export import list = lazy . list ;
205
+ export import when = lazy . when ;
206
+ export const version = pli . version ( ) ;
207
+
208
+ export import Int8 = DataType . Int8 ;
209
+ export import Int16 = DataType . Int16 ;
210
+ export import Int32 = DataType . Int32 ;
211
+ export import Int64 = DataType . Int64 ;
212
+ export import UInt8 = DataType . UInt8 ;
213
+ export import UInt16 = DataType . UInt16 ;
214
+ export import UInt32 = DataType . UInt32 ;
215
+ export import UInt64 = DataType . UInt64 ;
216
+ export import Float32 = DataType . Float32 ;
217
+ export import Float64 = DataType . Float64 ;
218
+ export import Bool = DataType . Bool ;
219
+ export import Utf8 = DataType . Utf8 ;
220
+ // biome-ignore lint/suspicious/noShadowRestrictedNames: pl.String
221
+ export import String = DataType . String ;
222
+ export import List = DataType . List ;
223
+ // biome-ignore lint/suspicious/noShadowRestrictedNames: pl.Date
224
+ export import Date = DataType . Date ;
225
+ export import Datetime = DataType . Datetime ;
226
+ export import Time = DataType . Time ;
227
+ // biome-ignore lint/suspicious/noShadowRestrictedNames: pl.Object
228
+ export import Object = DataType . Object ;
229
+ export import Null = DataType . Null ;
230
+ export import Struct = DataType . Struct ;
231
+
232
+ /**
233
+ * Run SQL queries against DataFrame/LazyFrame data.
234
+ *
235
+ * @warning This functionality is considered **unstable**, although it is close to being
236
+ * considered stable. It may be changed at any point without it being considered
237
+ * a breaking change.
238
+ */
239
+ export function SQLContext (
240
+ frames ?: Record < string , DataFrame | LazyDataFrame > ,
241
+ ) : sql . SQLContext {
242
+ return new sql . SQLContext ( frames ) ;
243
+ }
0 commit comments