ENH: Add nrows parameter to pd.read_json · Issue #33916 · pandas-dev/pandas (original) (raw)
Is your feature request related to a problem?
Let's say I have a huge jsonlines
file and I want to read only the first n
lines of the file.
Describe the solution you'd like
This problem could be fixed by adding nrows
parameter in method pd.read_json
. This parameter should be applicable if and only if lines=True
API breaking implications
Simply add and implement nrows
parameter in pd.read_json
(like pd.read_csv
).
Additional context
How this enhancement could work:
import pandas as pd
df = pd.read_json('/path/to/file.jsonlines', lines=True, nrows=1000)