Skip to content

API: read_json should follow general default of microseconds #63442

@jorisvandenbossche

Description

@jorisvandenbossche

pd.read_json still returns nanoseconds always:

>>> df = pd.DataFrame({"col": range(5), "dates": pd.date_range("2025", periods=5)})
>>> s = df.to_json(date_format="iso")
>>> pd.read_json(io.StringIO(s), convert_dates=["dates"]).dtypes
col               int64
dates    datetime64[ns]
dtype: object

Since JSON is a format like CSV that has no type / unit information stored, we should follow the general default of microseconds (or nanoseconds if those are present), like we do for CSV (or HTML, XML, excel, etc)

Metadata

Metadata

Assignees

No one assigned

    Labels

    IO JSONread_json, to_json, json_normalizeTimestamppd.Timestamp and associated methods

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions