Skip to content

ENH: Add nrows parameter to pd.read_json #33916

Closed
@sp1thas

Description

@sp1thas

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)

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions