-
-
Notifications
You must be signed in to change notification settings - Fork 19.4k
Open
Labels
BugNeeds TriageIssue that has not been reviewed by a pandas team memberIssue that has not been reviewed by a pandas team member
Description
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
# based on test_timedelta_as_label
df = pd.DataFrame([[1]], columns=[pd.Timedelta("1D").as_unit("us")])
result = df.to_json(date_format="iso")
expected = '{{"P1DT0H0M0S":{{"0":1}}}}'
assert result == expected # nope! '{"P0DT0H1M26.400S":{"0":1}}'
result = df.to_json(date_format="epoch")
expected = '{{"86400000":{{"0":1}}}}'
assert result == expected # nope! '{"86400":{"0":1}}'Issue Description
#63196 affects test_timedelta_as_label so that we get "us" unit for df.columns (in the example i added the .as_unit("us"), which affects the to_json output. For the epoch format that might be plausible but the iso format case is pretty clearly wrong.
cc @WillAyd
Expected Behavior
N/A
Installed Versions
Replace this line with the output of pd.show_versions()
Metadata
Metadata
Assignees
Labels
BugNeeds TriageIssue that has not been reviewed by a pandas team memberIssue that has not been reviewed by a pandas team member