Json line library
Project description
Json Line library
this is a library aiming to handle json line files.
What is a Json line file (*.jsonl)
A json line file is a text file where each line is a single json document.
The advantages to have a jsonl file are:
- fast reading, we don't need to wait to read the entire file to know data
- skip lines very fast without parsing json documents
- we can read a jsonl file in parallel
Installation
pip install jsonl
Usage
from jsonl import Jsonl
#read whole file
data0 = [x for x in Jsonl("/path/to/file")]
#alternative to read
data1 = list(Jsonl("/path/to/file"))
#read 100 rows after row 20
data2 = [x for x in Jsonl("/path/to/file", offset=20, limit=100)]
#write objects
data3=[{"name":"Newton"}, {"name":"Galileo"}]
Jsonl("/path/to/file","w").write(data3)
If the file is located in the cloud,
you only need to configure your environment
Jsonl
class will handle it for aws, gcp, etc.
Jsonl
can handle .zip
or .gz
files automatically
you only need to specify the right extension in the path
#Author Pedro Mayorga.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
jsonl2-1.1.14.tar.gz
(4.5 kB
view details)
Built Distribution
File details
Details for the file jsonl2-1.1.14.tar.gz
.
File metadata
- Download URL: jsonl2-1.1.14.tar.gz
- Upload date:
- Size: 4.5 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.1 CPython/3.11.3
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 7eb67968c123a653230d6df86348688730c121c88ff6ac617eae79f20505226b |
|
MD5 | 8a924a15fce6122a48066456a6039c80 |
|
BLAKE2b-256 | 939e1e5796c42766f34f142ee33be5a4f21512b18a011f118381f64b0ec2547a |
File details
Details for the file jsonl2-1.1.14-py3-none-any.whl
.
File metadata
- Download URL: jsonl2-1.1.14-py3-none-any.whl
- Upload date:
- Size: 5.0 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.1 CPython/3.11.3
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 970c081369e1e613c0b56b5c7ae2e746d48977ae59bae73d1690a467e527f435 |
|
MD5 | ab64cf8f9e838918e74355212bbbf4ba |
|
BLAKE2b-256 | f681fb274732e9bef62ea9191616e5bd0895643adbdf110a4d16afe446056fb1 |