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

jsonpickle.dumps() not serializing pandas' index freq, or jsonpickle.loads() no deserializing it. #324

Open
thompsonp17 opened this issue Oct 14, 2020 · 0 comments

Comments

@thompsonp17
Copy link

Hi, folks. I've just got a problem when trying to serialize a pandas DataFrame.

Python version: 3.7.5
jsonpickle version: 1.4.1

My df, here called dataset, has this index:

>>> dataset.index
DatetimeIndex(['2020-01-01 00:00:00+00:00', '2020-01-01 01:00:00+00:00',
               '2020-01-01 02:00:00+00:00', '2020-01-01 03:00:00+00:00',
               '2020-01-01 04:00:00+00:00', '2020-01-01 05:00:00+00:00',
               '2020-01-01 06:00:00+00:00', '2020-01-01 07:00:00+00:00',
               '2020-01-01 08:00:00+00:00', '2020-01-01 09:00:00+00:00',
               ...
               '2020-01-30 15:00:00+00:00', '2020-01-30 16:00:00+00:00',
               '2020-01-30 17:00:00+00:00', '2020-01-30 18:00:00+00:00',
               '2020-01-30 19:00:00+00:00', '2020-01-30 20:00:00+00:00',
               '2020-01-30 21:00:00+00:00', '2020-01-30 22:00:00+00:00',
               '2020-01-30 23:00:00+00:00', '2020-01-31 00:00:00+00:00'],
              dtype='datetime64[ns, UTC]', length=721, freq='<DateOffset: seconds=3600>')

Now, look to this result, paying particular attention to freq:

jsonpickle.loads(jsonpickle.dumps(dataset)).index
DatetimeIndex(['2020-01-01 00:00:00+00:00', '2020-01-01 01:00:00+00:00',
               '2020-01-01 02:00:00+00:00', '2020-01-01 03:00:00+00:00',
               '2020-01-01 04:00:00+00:00', '2020-01-01 05:00:00+00:00',
               '2020-01-01 06:00:00+00:00', '2020-01-01 07:00:00+00:00',
               '2020-01-01 08:00:00+00:00', '2020-01-01 09:00:00+00:00',
               ...
               '2020-01-30 15:00:00+00:00', '2020-01-30 16:00:00+00:00',
               '2020-01-30 17:00:00+00:00', '2020-01-30 18:00:00+00:00',
               '2020-01-30 19:00:00+00:00', '2020-01-30 20:00:00+00:00',
               '2020-01-30 21:00:00+00:00', '2020-01-30 22:00:00+00:00',
               '2020-01-30 23:00:00+00:00', '2020-01-31 00:00:00+00:00'],
              dtype='datetime64[ns, UTC]', length=721, freq=None)

So, it seems like the package is not serializing or deserializing the whole object.

Thank you in advance.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant