Skip to content

BUG: AttributeError about dateutil.relativedelta when calling pd.read_json(json_data) #59227

@cspzyy

Description

@cspzyy

Pandas version checks

  • I have checked that this issue has not already been reported.

  • I have confirmed this bug exists on the latest version of pandas.

  • I have confirmed this bug exists on the main branch of pandas.

Reproducible Example

import pandas as pd
import json

df = pd.read_json(json.dumps(json_data), orient='table')

Issue Description

When I used df.read_json(json_data), It calls the function pandas._libs.tslibs.parsing.dateutil_parse() in pandas package. The specific path is python3.8/site-packages/pandas/_libs/tslibs/parsing.pyx:692. Then AttributeError occurs: AttributeError: type object 'relativedelta' has no attribute 'relativedelta'

Now I'm desperate to process this json_data, but with this error I can't work with it correctly. Besides, pandas has no setup.py in the root directory, so I can't correct and use my custom adjustment.

DESPERATE to hear from u!!!! And THANKS so much for paying attention to this!

Expected Behavior

The source code uses from dateutil.relativedelta import relativedelta, thus when code in the function says relativedelta.relativedelta, the executor will be confused.

I consider if u can try ret+relativedelta()? Or anything else will work

Installed Versions

pandas 2.0.3

Metadata

Metadata

Assignees

Labels

BugIO JSONread_json, to_json, json_normalizeNeeds TriageIssue that has not been reviewed by a pandas team member

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions