Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add Timedelta Support to JSON Reader with orient="table" #21140

Open
WillAyd opened this issue May 20, 2018 · 4 comments
Open

Add Timedelta Support to JSON Reader with orient="table" #21140

WillAyd opened this issue May 20, 2018 · 4 comments
Labels
Enhancement IO JSON read_json, to_json, json_normalize

Comments

@WillAyd
Copy link
Member

WillAyd commented May 20, 2018

Right now trying to parse JSON using orient='table' will fail if the object contains Timedeltas intentionally:

if 'timedelta64' in dtypes.values():

Since #19065 was merged I think this should now be possible if anyone wants to take a look

@WillAyd WillAyd added IO JSON read_json, to_json, json_normalize good first issue labels May 20, 2018
@nprad
Copy link
Contributor

nprad commented May 20, 2018

I would like to work on this issue!

@fjdiod
Copy link
Contributor

fjdiod commented Jun 29, 2018

Hello, should pd.Timedelta be used for parsing here? I mean, use it somewhere inside parse_table_schema?

@WillAyd
Copy link
Member Author

WillAyd commented Jun 29, 2018

Yes IIRC correctly the limiting factor previously was that timedeltas are represented as ISO 8601 durations in the JSON table Schema, but when this was first built the Timedelta constructor would not parse that duration format as an argument.

Since the PR in the original post that is no longer an issue so this should be possible to do now

@fjdiod
Copy link
Contributor

fjdiod commented Jul 5, 2018

Now, if parse durations with Timedelta constructor in parse_table_schema, they get coerced into int64 after, in FrameParser from json.py(it seems that it tries to coerce floats without decimal digits). Is it expected behavior? Maybe their dtype should be changed from timedelta64 to timedelta64[ns]?

fjdiod added a commit to fjdiod/pandas that referenced this issue Jul 20, 2018
…ev#21140)

add iso-format support to to_timedelta

Revert "add iso-format support to to_timedelta"

This reverts commit 3f5f176.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Enhancement IO JSON read_json, to_json, json_normalize
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants