CSVChunkProcessor๏
Inherits: RefCounted < Object
Chunked CSV file utilities.
Description๏
CSVChunkProcessor provides helpers for processing large CSV files in bounded chunks, sampling rows, counting rows, splitting files, and merging files. When no dialect is provided, the default CSV dialect is used.
Methods๏
count_rows(path: String, dialect: CSVDialect = null) static |
|
merge_files(paths: PackedStringArray, output_path: String, dialect: CSVDialect = null, include_headers: bool = true) static |
|
process_file(path: String, callable: Callable, chunk_size: int = 1000, dialect: CSVDialect = null) static |
|
sample_file(path: String, count: int = 10, dialect: CSVDialect = null) static |
|
split_file(path: String, output_dir: String, rows_per_file: int, dialect: CSVDialect = null, include_headers: bool = true) static |
Method Descriptions๏
int count_rows(path: String, dialect: CSVDialect = null) static ๐
Counts rows in path using dialect. Returns -1 on error.
Error merge_files(paths: PackedStringArray, output_path: String, dialect: CSVDialect = null, include_headers: bool = true) static ๐
Merges paths into output_path using dialect. If include_headers is true and the dialect has headers, one header row is written to the output.
Error process_file(path: String, callable: Callable, chunk_size: int = 1000, dialect: CSVDialect = null) static ๐
Reads path in chunks of chunk_size rows and calls callable with (chunk, chunk_index).
Array sample_file(path: String, count: int = 10, dialect: CSVDialect = null) static ๐
Returns up to count rows from the start of path using dialect.
PackedStringArray split_file(path: String, output_dir: String, rows_per_file: int, dialect: CSVDialect = null, include_headers: bool = true) static ๐
Splits path into files in output_dir, writing up to rows_per_file rows per output file.