@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.
Files changed (71) hide show
  1. package/LICENSE +19 -0
  2. package/README.md +217 -0
  3. package/bin/cfg.d.ts +156 -0
  4. package/bin/cfg.js +52 -0
  5. package/bin/dataframe.d.ts +2135 -0
  6. package/bin/dataframe.js +783 -0
  7. package/bin/datatypes/conversion.d.ts +2 -0
  8. package/bin/datatypes/conversion.js +2 -0
  9. package/bin/datatypes/datatype.d.ts +285 -0
  10. package/bin/datatypes/datatype.js +430 -0
  11. package/bin/datatypes/field.d.ts +26 -0
  12. package/bin/datatypes/field.js +36 -0
  13. package/bin/datatypes/index.d.ts +43 -0
  14. package/bin/datatypes/index.js +120 -0
  15. package/bin/error.d.ts +7 -0
  16. package/bin/error.js +17 -0
  17. package/bin/functions.d.ts +26 -0
  18. package/bin/functions.js +208 -0
  19. package/bin/groupby.d.ts +212 -0
  20. package/bin/groupby.js +156 -0
  21. package/bin/html.d.ts +4 -0
  22. package/bin/html.js +18 -0
  23. package/bin/index.d.ts +256 -0
  24. package/bin/index.js +267 -0
  25. package/bin/internals/construction.d.ts +7 -0
  26. package/bin/internals/construction.js +256 -0
  27. package/bin/internals/polars_internal.d.ts +2 -0
  28. package/bin/internals/polars_internal.js +7 -0
  29. package/bin/io.d.ts +433 -0
  30. package/bin/io.js +344 -0
  31. package/bin/lazy/dataframe.d.ts +785 -0
  32. package/bin/lazy/dataframe.js +427 -0
  33. package/bin/lazy/expr/datetime.d.ts +8 -0
  34. package/bin/lazy/expr/datetime.js +27 -0
  35. package/bin/lazy/expr/index.d.ts +1152 -0
  36. package/bin/lazy/expr/index.js +632 -0
  37. package/bin/lazy/expr/list.d.ts +8 -0
  38. package/bin/lazy/expr/list.js +115 -0
  39. package/bin/lazy/expr/string.d.ts +534 -0
  40. package/bin/lazy/expr/string.js +131 -0
  41. package/bin/lazy/expr/struct.d.ts +126 -0
  42. package/bin/lazy/expr/struct.js +26 -0
  43. package/bin/lazy/functions.d.ts +612 -0
  44. package/bin/lazy/functions.js +687 -0
  45. package/bin/lazy/groupby.d.ts +29 -0
  46. package/bin/lazy/groupby.js +30 -0
  47. package/bin/lazy/index.d.ts +4 -0
  48. package/bin/lazy/index.js +20 -0
  49. package/bin/lazy/whenthen.d.ts +67 -0
  50. package/bin/lazy/whenthen.js +81 -0
  51. package/bin/native-polars.d.ts +2 -0
  52. package/bin/native-polars.js +267 -0
  53. package/bin/series/datetime.d.ts +8 -0
  54. package/bin/series/datetime.js +34 -0
  55. package/bin/series/index.d.ts +1135 -0
  56. package/bin/series/index.js +700 -0
  57. package/bin/series/list.d.ts +8 -0
  58. package/bin/series/list.js +87 -0
  59. package/bin/series/string.d.ts +300 -0
  60. package/bin/series/string.js +125 -0
  61. package/bin/series/struct.d.ts +36 -0
  62. package/bin/series/struct.js +35 -0
  63. package/bin/shared_traits.d.ts +1458 -0
  64. package/bin/shared_traits.js +2 -0
  65. package/bin/sql.d.ts +244 -0
  66. package/bin/sql.js +63 -0
  67. package/bin/types.d.ts +287 -0
  68. package/bin/types.js +2 -0
  69. package/bin/utils.d.ts +38 -0
  70. package/bin/utils.js +69 -0
  71. package/package.json +45 -0
package/bin/io.d.ts ADDED
@@ -0,0 +1,433 @@
1
+ import { type Readable } from "node:stream";
2
+ import { type DataFrame } from "./dataframe";
3
+ import type { DataType } from "./datatypes";
4
+ import { type LazyDataFrame } from "./lazy/dataframe";
5
+ import type { ReadParquetOptions, RowCount, ScanParquetOptions } from "./types";
6
+ export interface ReadCsvOptions {
7
+ inferSchemaLength: number | null;
8
+ batchSize: number;
9
+ nRows: number;
10
+ hasHeader: boolean;
11
+ ignoreErrors: boolean;
12
+ endRows: number;
13
+ startRows: number;
14
+ projection: number;
15
+ sep: string;
16
+ schema: Record<string, DataType>;
17
+ columns: string[];
18
+ rechunk: boolean;
19
+ encoding: "utf8" | "utf8-lossy";
20
+ numThreads: number;
21
+ dtypes: Record<string, DataType>;
22
+ lowMemory: boolean;
23
+ commentPrefix: string;
24
+ quoteChar: string;
25
+ eolChar: string;
26
+ nullValues: string | Array<string> | Record<string, string>;
27
+ chunkSize: number;
28
+ skipRows: number;
29
+ tryParseDates: boolean;
30
+ skipRowsAfterHeader: number;
31
+ rowCount: RowCount;
32
+ raiseIfEmpty: boolean;
33
+ truncateRaggedLines: boolean;
34
+ missingIsNull: boolean;
35
+ }
36
+ export interface ReadJsonOptions {
37
+ batchSize: number;
38
+ inferSchemaLength: number | null;
39
+ format: "lines" | "json";
40
+ }
41
+ export declare function readRecords(records: Record<string, any>[], options?: {
42
+ schema: Record<string, DataType>;
43
+ }): DataFrame;
44
+ export declare function readRecords(records: Record<string, any>[], options?: {
45
+ inferSchemaLength?: number;
46
+ }): DataFrame;
47
+ /**
48
+ * __Read a CSV file or string into a Dataframe.__
49
+ * ___
50
+ * @param pathOrBody - path or buffer or string
51
+ * - path: Path to a file or a file like string. Any valid filepath can be used. Example: `file.csv`.
52
+ * - body: String or buffer to be read as a CSV
53
+ * @param options
54
+ * @param options.inferSchemaLength -Maximum number of lines to read to infer schema. If set to 0, all columns will be read as pl.Utf8.
55
+ * If set to `null`, a full table scan will be done (slow).
56
+ * @param options.nRows -After n rows are read from the CSV, it stops reading.
57
+ * During multi-threaded parsing, an upper bound of `n` rows
58
+ * cannot be guaranteed.
59
+ * @param options.batchSize - Number of lines to read into the buffer at once. Modify this to change performance.
60
+ * @param options.hasHeader - Indicate if first row of dataset is header or not. If set to False first row will be set to `column_x`,
61
+ * `x` being an enumeration over every column in the dataset.
62
+ * @param options.ignoreErrors -Try to keep reading lines if some lines yield errors.
63
+ * @param options.endRows -After n rows are read from the CSV, it stops reading.
64
+ * During multi-threaded parsing, an upper bound of `n` rows
65
+ * cannot be guaranteed.
66
+ * @param options.startRows -Start reading after `startRows` position.
67
+ * @param options.projection -Indices of columns to select. Note that column indices start at zero.
68
+ * @param options.sep -Character to use as delimiter in the file.
69
+ * @param options.columns -Columns to select.
70
+ * @param options.rechunk -Make sure that all columns are contiguous in memory by aggregating the chunks into a single array.
71
+ * @param options.encoding -Allowed encodings: `utf8`, `utf8-lossy`. Lossy means that invalid utf8 values are replaced with `�` character.
72
+ * @param options.numThreads -Number of threads to use in csv parsing. Defaults to the number of physical cpu's of your system.
73
+ * @param options.dtype -Overwrite the dtypes during inference.
74
+ * @param options.schema -Set the CSV file's schema. This only accepts datatypes that are implemented in the csv parser and expects a complete Schema.
75
+ * @param options.lowMemory - Reduce memory usage in expense of performance.
76
+ * @param options.commentPrefix - character that indicates the start of a comment line, for instance '#'.
77
+ * @param options.quoteChar - Character that is used for csv quoting, Default: '"'. Set to null to turn special handling and escaping of quotes off.
78
+ * @param options.nullValues - Values to interpret as null values. You can provide a
79
+ * - `string` -> all values encountered equal to this string will be null
80
+ * - `Array<string>` -> A null value per column.
81
+ * - `Record<string,string>` -> An object or map that maps column name to a null value string.Ex. {"column_1": 0}
82
+ * @param options.parseDates -Whether to attempt to parse dates or not
83
+ * @returns DataFrame
84
+ */
85
+ export declare function readCSV(pathOrBody: string | Buffer, options?: Partial<ReadCsvOptions>): DataFrame;
86
+ export interface ScanCsvOptions {
87
+ hasHeader: boolean;
88
+ sep: string;
89
+ commentPrefix: string;
90
+ quoteChar: string;
91
+ skipRows: number;
92
+ nullValues: string | Array<string> | Record<string, string>;
93
+ ignoreErrors: boolean;
94
+ cache: boolean;
95
+ inferSchemaLength: number | null;
96
+ rechunk: boolean;
97
+ nRows: number;
98
+ encoding: string;
99
+ lowMemory: boolean;
100
+ parseDates: boolean;
101
+ skipRowsAfterHeader: number;
102
+ eolChar: string;
103
+ missingUtf8IsEmptyString: boolean;
104
+ raiseIfEmpty: boolean;
105
+ truncateRaggedLines: boolean;
106
+ schema: Record<string, DataType>;
107
+ }
108
+ /**
109
+ * __Lazily read from a CSV file or multiple files via glob patterns.__
110
+ *
111
+ * This allows the query optimizer to push down predicates and
112
+ * projections to the scan level, thereby potentially reducing
113
+ * memory overhead.
114
+ * ___
115
+ * @param path path to a file
116
+ * @param options.hasHeader - Indicate if first row of dataset is header or not. If set to False first row will be set to `column_x`,
117
+ * `x` being an enumeration over every column in the dataset.
118
+ * @param options.sep -Character to use as delimiter in the file.
119
+ * @param options.commentPrefix - character that indicates the start of a comment line, for instance '#'.
120
+ * @param options.quoteChar -character that is used for csv quoting. Default: '"'. Set to null to turn special handling and escaping of quotes off.
121
+ * @param options.skipRows -Start reading after `skipRows` position.
122
+ * @param options.nullValues - Values to interpret as null values. You can provide a
123
+ * - `string` -> all values encountered equal to this string will be null
124
+ * - `Array<string>` -> A null value per column.
125
+ * - `Record<string,string>` -> An object or map that maps column name to a null value string.Ex. {"column_1": 0}
126
+ * @param options.ignoreErrors -Try to keep reading lines if some lines yield errors.
127
+ * @param options.cache Cache the result after reading.
128
+ * @param options.inferSchemaLength -Maximum number of lines to read to infer schema. If set to 0, all columns will be read as pl.Utf8.
129
+ * If set to `null`, a full table scan will be done (slow).
130
+ * @param options.nRows -After n rows are read from the CSV, it stops reading.
131
+ * During multi-threaded parsing, an upper bound of `n` rows
132
+ * cannot be guaranteed.
133
+ * @param options.rechunk -Make sure that all columns are contiguous in memory by aggregating the chunks into a single array.
134
+ * @param options.lowMemory - Reduce memory usage in expense of performance.
135
+ * ___
136
+ *
137
+ */
138
+ export declare function scanCSV(path: string, options?: Partial<ScanCsvOptions>): LazyDataFrame;
139
+ /**
140
+ * __Read a JSON file or string into a DataFrame.__
141
+ *
142
+ * @param pathOrBody - path or buffer or string
143
+ * - path: Path to a file or a file like string. Any valid filepath can be used. Example: `file.csv`.
144
+ * - body: String or buffer to be read as a CSV
145
+ * @param options
146
+ * @param options.inferSchemaLength -Maximum number of lines to read to infer schema. If set to 0, all columns will be read as pl.Utf8.
147
+ * If set to `null`, a full table scan will be done (slow).
148
+ * @param options.format - Either "lines" or "json"
149
+ * @param options.batchSize - Number of lines to read into the buffer at once. Modify this to change performance.
150
+ * @returns ({@link DataFrame})
151
+ * @example
152
+ * ```
153
+ * const jsonString = `
154
+ * {"a": 1, "b": "foo", "c": 3}
155
+ * {"a": 2, "b": "bar", "c": 6}
156
+ * `
157
+ * > const df = pl.readJSON(jsonString, {"format": "lines"})
158
+ * > console.log(df)
159
+ * shape: (2, 3)
160
+ * ╭─────┬─────┬─────╮
161
+ * │ a ┆ b ┆ c │
162
+ * │ --- ┆ --- ┆ --- │
163
+ * │ i64 ┆ str ┆ i64 │
164
+ * ╞═════╪═════╪═════╡
165
+ * │ 1 ┆ foo ┆ 3 │
166
+ * ├╌╌╌╌╌┼╌╌╌╌╌┼╌╌╌╌╌┤
167
+ * │ 2 ┆ bar ┆ 6 │
168
+ * ╰─────┴─────┴─────╯
169
+ * ```
170
+ */
171
+ export declare function readJSON(pathOrBody: string | Buffer, options?: Partial<ReadJsonOptions>): DataFrame;
172
+ interface ScanJsonOptions {
173
+ inferSchemaLength: number | null;
174
+ nThreads: number;
175
+ batchSize: number;
176
+ lowMemory: boolean;
177
+ numRows: number;
178
+ skipRows: number;
179
+ rowCount: RowCount;
180
+ }
181
+ /**
182
+ * __Read a JSON file or string into a DataFrame.__
183
+ *
184
+ * _Note: Currently only newline delimited JSON is supported_
185
+ * @param path - path to json file
186
+ * - path: Path to a file or a file like string. Any valid filepath can be used. Example: `./file.json`.
187
+ * @param options
188
+ * @param options.inferSchemaLength -Maximum number of lines to read to infer schema. If set to 0, all columns will be read as pl.Utf8.
189
+ * If set to `null`, a full table scan will be done (slow).
190
+ * @param options.nThreads - Maximum number of threads to use when reading json.
191
+ * @param options.lowMemory - Reduce memory usage in expense of performance.
192
+ * @param options.batchSize - Number of lines to read into the buffer at once. Modify this to change performance.
193
+ * @param options.numRows Stop reading from parquet file after reading ``numRows``.
194
+ * @param options.skipRows -Start reading after ``skipRows`` position.
195
+ * @param options.rowCount Add row count as column
196
+ * @returns ({@link DataFrame})
197
+ * @example
198
+ * ```
199
+ * > const df = pl.scanJson('path/to/file.json', {numRows: 2}).collectSync()
200
+ * > console.log(df)
201
+ * shape: (2, 3)
202
+ * ╭─────┬─────┬─────╮
203
+ * │ a ┆ b ┆ c │
204
+ * │ --- ┆ --- ┆ --- │
205
+ * │ i64 ┆ str ┆ i64 │
206
+ * ╞═════╪═════╪═════╡
207
+ * │ 1 ┆ foo ┆ 3 │
208
+ * ├╌╌╌╌╌┼╌╌╌╌╌┼╌╌╌╌╌┤
209
+ * │ 2 ┆ bar ┆ 6 │
210
+ * ╰─────┴─────┴─────╯
211
+ * ```
212
+ */
213
+ export declare function scanJson(path: string, options?: Partial<ScanJsonOptions>): LazyDataFrame;
214
+ /**
215
+ * Read into a DataFrame from a parquet file.
216
+ * @param pathOrBody
217
+ * Path to a file, list of files, or a file like object. If the path is a directory, that directory will be used
218
+ * as partition aware scan.
219
+ * @param options.columns Columns to select. Accepts a list of column indices (starting at zero) or a list of column names.
220
+ * @param options.numRows Stop reading from parquet file after reading ``numRows``.
221
+ * @param options.parallel
222
+ * Any of 'auto' | 'columns' | 'row_groups' | 'none'
223
+ This determines the direction of parallelism. 'auto' will try to determine the optimal direction.
224
+ Defaults to 'auto'
225
+ * @param options.rowCount Add row count as column
226
+ */
227
+ export declare function readParquet(pathOrBody: string | Buffer, options?: Partial<ReadParquetOptions>): DataFrame;
228
+ export interface ReadAvroOptions {
229
+ columns: string[] | Array<string> | number[];
230
+ projection: number;
231
+ nRows: number;
232
+ }
233
+ /**
234
+ * Read into a DataFrame from an avro file.
235
+ * @param pathOrBody
236
+ * Path to a file, list of files, or a file like object. If the path is a directory, that directory will be used
237
+ * as partition aware scan.
238
+ * @param options.columns Columns to select. Accepts a list of column names.
239
+ * @param options.projection -Indices of columns to select. Note that column indices start at zero.
240
+ * @param options.nRows Stop reading from avro file after reading ``nRows``.
241
+ */
242
+ export declare function readAvro(pathOrBody: string | Buffer, options?: Partial<ReadAvroOptions>): DataFrame;
243
+ /**
244
+ * Lazily read from a local or cloud-hosted parquet file (or files).
245
+
246
+ This function allows the query optimizer to push down predicates and projections to
247
+ the scan level, typically increasing performance and reducing memory overhead.
248
+
249
+ * This allows the query optimizer to push down predicates and projections to the scan level,
250
+ * thereby potentially reducing memory overhead.
251
+ * @param source - Path(s) to a file. If a single path is given, it can be a globbing pattern.
252
+ @param options.nRows - Stop reading from parquet file after reading `n_rows`.
253
+ @param options.rowIndexName - If not None, this will insert a row index column with the given name into the DataFrame
254
+ @param options.rowIndexOffset - Offset to start the row index column (only used if the name is set)
255
+ @param options.parallel : {'auto', 'columns', 'row_groups', 'none'}
256
+ This determines the direction of parallelism. 'auto' will try to determine the optimal direction.
257
+ @param options.useStatistics - Use statistics in the parquet to determine if pages can be skipped from reading.
258
+ @param options.hivePartitioning - Infer statistics and schema from hive partitioned URL and use them to prune reads.
259
+ @param options.glob - Expand path given via globbing rules.
260
+ @param options.hiveSchema - The column names and data types of the columns by which the data is partitioned.
261
+ If set to `None` (default), the schema of the Hive partitions is inferred.
262
+ @param options.tryParseHiveDates - Whether to try parsing hive values as date/datetime types.
263
+ @param options.rechunk - In case of reading multiple files via a glob pattern rechunk the final DataFrame into contiguous memory chunks.
264
+ @param options.lowMemory - Reduce memory pressure at the expense of performance.
265
+ @param options.cache - Cache the result after reading.
266
+ @param options.cloudOptions - Options that indicate how to connect to a cloud provider.
267
+ If the cloud provider is not supported by Polars, the storage options are passed to `fsspec.open()`.
268
+
269
+ The cloud providers currently supported are AWS, GCP, and Azure.
270
+ See supported keys here:
271
+
272
+ * `aws <https://docs.rs/object_store/latest/object_store/aws/enum.AmazonS3ConfigKey.html>`_
273
+ * `gcp <https://docs.rs/object_store/latest/object_store/gcp/enum.GoogleConfigKey.html>`_
274
+ * `azure <https://docs.rs/object_store/latest/object_store/azure/enum.AzureConfigKey.html>`_
275
+
276
+ If `cloudOptions` is not provided, Polars will try to infer the information from environment variables.
277
+ @param options.retries - Number of retries if accessing a cloud instance fails.
278
+ @param options.includeFilePaths - Include the path of the source file(s) as a column with this name.
279
+
280
+ @example
281
+ ```
282
+ const lazyDf = pl.scanParquet("s3://[bucket-name]/[file-key]", {
283
+ cloudOptions: {
284
+ aws_access_key_id: credentials.accessKeyId,
285
+ aws_secret_access_key: credentials.secretAccessKey,
286
+ aws_session_token: credentials.sessionToken,
287
+ aws_region: "us-east-1",
288
+ },
289
+ });
290
+ ```
291
+ */
292
+ export declare function scanParquet(source: string, options?: ScanParquetOptions): LazyDataFrame<any>;
293
+ export interface ReadIPCOptions {
294
+ columns: string[] | number[];
295
+ nRows: number;
296
+ }
297
+ /**
298
+ * __Read into a DataFrame from Arrow IPC file (Feather v2).__
299
+ * ___
300
+ * @param pathOrBody - path or buffer or string
301
+ * - path: Path to a file or a file like string. Any valid filepath can be used. Example: `file.ipc`.
302
+ * - body: String or buffer to be read as Arrow IPC
303
+ * @param options.columns Columns to select. Accepts a list of column names.
304
+ * @param options.nRows Stop reading from parquet file after reading ``nRows``.
305
+ */
306
+ export declare function readIPC(pathOrBody: string | Buffer, options?: Partial<ReadIPCOptions>): DataFrame;
307
+ /**
308
+ * __Read into a DataFrame from Arrow IPC stream.__
309
+ * ___
310
+ * @param pathOrBody - path or buffer or string
311
+ * - path: Path to a file or a file like string. Any valid filepath can be used. Example: `file.ipc`.
312
+ * - body: String or buffer to be read as Arrow IPC
313
+ * @param options.columns Columns to select. Accepts a list of column names.
314
+ * @param options.nRows Stop reading from parquet file after reading ``nRows``.
315
+ */
316
+ export declare function readIPCStream(pathOrBody: string | Buffer, options?: Partial<ReadIPCOptions>): DataFrame;
317
+ export interface ScanIPCOptions {
318
+ nRows: number;
319
+ cache: boolean;
320
+ rechunk: boolean;
321
+ }
322
+ /**
323
+ * __Lazily read from an Arrow IPC file (Feather v2) or multiple files via glob patterns.__
324
+ * ___
325
+ * @param path Path to a IPC file.
326
+ * @param options.nRows Stop reading from IPC file after reading ``nRows``
327
+ * @param options.cache Cache the result after reading.
328
+ * @param options.rechunk Reallocate to contiguous memory when all chunks/ files are parsed.
329
+ */
330
+ export declare function scanIPC(path: string, options?: Partial<ScanIPCOptions>): LazyDataFrame;
331
+ /**
332
+ * __Read a stream into a Dataframe.__
333
+ *
334
+ * **Warning:** this is much slower than `scanCSV` or `readCSV`
335
+ *
336
+ * This will consume the entire stream into a single buffer and then call `readCSV`
337
+ * Only use it when you must consume from a stream, or when performance is not a major consideration
338
+ *
339
+ * ___
340
+ * @param stream - readable stream containing csv data
341
+ * @param options
342
+ * @param options.inferSchemaLength -Maximum number of lines to read to infer schema. If set to 0, all columns will be read as pl.Utf8.
343
+ * If set to `null`, a full table scan will be done (slow).
344
+ * @param options.batchSize - Number of lines to read into the buffer at once. Modify this to change performance.
345
+ * @param options.hasHeader - Indicate if first row of dataset is header or not. If set to False first row will be set to `column_x`,
346
+ * `x` being an enumeration over every column in the dataset.
347
+ * @param options.ignoreErrors -Try to keep reading lines if some lines yield errors.
348
+ * @param options.endRows -After n rows are read from the CSV, it stops reading.
349
+ * During multi-threaded parsing, an upper bound of `n` rows
350
+ * cannot be guaranteed.
351
+ * @param options.startRows -Start reading after `startRows` position.
352
+ * @param options.projection -Indices of columns to select. Note that column indices start at zero.
353
+ * @param options.sep -Character to use as delimiter in the file.
354
+ * @param options.columns -Columns to select.
355
+ * @param options.rechunk -Make sure that all columns are contiguous in memory by aggregating the chunks into a single array.
356
+ * @param options.encoding -Allowed encodings: `utf8`, `utf8-lossy`. Lossy means that invalid utf8 values are replaced with `�` character.
357
+ * @param options.numThreads -Number of threads to use in csv parsing. Defaults to the number of physical cpu's of your system.
358
+ * @param options.dtype -Overwrite the dtypes during inference.
359
+ * @param options.lowMemory - Reduce memory usage in expense of performance.
360
+ * @param options.commentPrefix - character that indicates the start of a comment line, for instance '#'.
361
+ * @param options.quoteChar -character that is used for csv quoting. Default: '"'. Set to null to turn special handling and escaping of quotes off.
362
+ * @param options.nullValues - Values to interpret as null values. You can provide a
363
+ * - `string` -> all values encountered equal to this string will be null
364
+ * - `Array<string>` -> A null value per column.
365
+ * - `Record<string,string>` -> An object or map that maps column name to a null value string.Ex. {"column_1": 0}
366
+ * @param options.parseDates -Whether to attempt to parse dates or not
367
+ * @returns Promise<DataFrame>
368
+ *
369
+ * @example
370
+ * ```
371
+ * >>> const readStream = new Stream.Readable({read(){}});
372
+ * >>> readStream.push(`a,b\n`);
373
+ * >>> readStream.push(`1,2\n`);
374
+ * >>> readStream.push(`2,2\n`);
375
+ * >>> readStream.push(`3,2\n`);
376
+ * >>> readStream.push(`4,2\n`);
377
+ * >>> readStream.push(null);
378
+ *
379
+ * >>> pl.readCSVStream(readStream).then(df => console.log(df));
380
+ * shape: (4, 2)
381
+ * ┌─────┬─────┐
382
+ * │ a ┆ b │
383
+ * │ --- ┆ --- │
384
+ * │ i64 ┆ i64 │
385
+ * ╞═════╪═════╡
386
+ * │ 1 ┆ 2 │
387
+ * ├╌╌╌╌╌┼╌╌╌╌╌┤
388
+ * │ 2 ┆ 2 │
389
+ * ├╌╌╌╌╌┼╌╌╌╌╌┤
390
+ * │ 3 ┆ 2 │
391
+ * ├╌╌╌╌╌┼╌╌╌╌╌┤
392
+ * │ 4 ┆ 2 │
393
+ * └─────┴─────┘
394
+ * ```
395
+ */
396
+ export declare function readCSVStream(stream: Readable, options?: Partial<ReadCsvOptions>): Promise<DataFrame>;
397
+ /**
398
+ * __Read a newline delimited JSON stream into a DataFrame.__
399
+ *
400
+ * @param stream - readable stream containing json data
401
+ * @param options
402
+ * @param options.inferSchemaLength -Maximum number of lines to read to infer schema. If set to 0, all columns will be read as pl.Utf8.
403
+ * If set to `null`, a full table scan will be done (slow).
404
+ * Note: this is done per batch
405
+ * @param options.batchSize - Number of lines to read into the buffer at once. Modify this to change performance.
406
+ * @example
407
+ * ```
408
+ * >>> const readStream = new Stream.Readable({read(){}});
409
+ * >>> readStream.push(`${JSON.stringify({a: 1, b: 2})} \n`);
410
+ * >>> readStream.push(`${JSON.stringify({a: 2, b: 2})} \n`);
411
+ * >>> readStream.push(`${JSON.stringify({a: 3, b: 2})} \n`);
412
+ * >>> readStream.push(`${JSON.stringify({a: 4, b: 2})} \n`);
413
+ * >>> readStream.push(null);
414
+ *
415
+ * >>> pl.readJSONStream(readStream, { format: "lines" }).then(df => console.log(df));
416
+ * shape: (4, 2)
417
+ * ┌─────┬─────┐
418
+ * │ a ┆ b │
419
+ * │ --- ┆ --- │
420
+ * │ i64 ┆ i64 │
421
+ * ╞═════╪═════╡
422
+ * │ 1 ┆ 2 │
423
+ * ├╌╌╌╌╌┼╌╌╌╌╌┤
424
+ * │ 2 ┆ 2 │
425
+ * ├╌╌╌╌╌┼╌╌╌╌╌┤
426
+ * │ 3 ┆ 2 │
427
+ * ├╌╌╌╌╌┼╌╌╌╌╌┤
428
+ * │ 4 ┆ 2 │
429
+ * └─────┴─────┘
430
+ * ```
431
+ */
432
+ export declare function readJSONStream(stream: Readable, options?: Partial<ReadJsonOptions>): Promise<DataFrame>;
433
+ export {};