Datasets:
Download tools/build_parquet.py from zeraulalmeida/Jurisprudencia_TRT_13: direct link, hf CLI and curl.
- Browser
- Download file 644 Bytes
-
https://huggingface.co/datasets/zeraulalmeida/Jurisprudencia_TRT_13/resolve/main/tools/build_parquet.py
- Command line
-
hf download hf://datasets/zeraulalmeida/Jurisprudencia_TRT_13/tools/build_parquet.py
-
curl -L -o build_parquet.py https://huggingface.co/datasets/zeraulalmeida/Jurisprudencia_TRT_13/resolve/main/tools/build_parquet.py
644 Bytes
| #!/usr/bin/env python3 | |
| """Build data/jurisprudencia_trt13.parquet from canonical JSONL. | |
| Requires: pyarrow>=18.0.0 | |
| """ | |
| from pathlib import Path | |
| import json | |
| import pyarrow as pa | |
| import pyarrow.parquet as pq | |
| root = Path(__file__).resolve().parents[1] | |
| src = root / "data" / "jurisprudencia_trt13.jsonl" | |
| dst = root / "data" / "jurisprudencia_trt13.parquet" | |
| rows = [] | |
| with src.open("r", encoding="utf-8") as f: | |
| for line in f: | |
| if line.strip(): | |
| rows.append(json.loads(line)) | |
| table = pa.Table.from_pylist(rows) | |
| pq.write_table(table, dst, compression="zstd", use_dictionary=True) | |
| print(f"Wrote {dst} with {table.num_rows} rows") | |