-
-
Notifications
You must be signed in to change notification settings - Fork 18.4k
BUG: Adding nano offset raises TypeError #9291
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
Conversation
@@ -2024,7 +2024,13 @@ def __add__(self, other): | |||
if type(self) == type(other): | |||
return type(self)(self.n + other.n) | |||
else: | |||
return _delta_to_tick(self.delta + other.delta) | |||
try: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this might be better to change the _inc
of all of the Tick
and sub-classes to use Timedelta
which properly handle these operations (e.g. Timedelta(1,'ns')
and so on)
this looks good |
Let me add explicit tests for backward compat and return type checks (pointed in #9309). I expect to finish it today. |
@jreback It's ready. Pls review. |
can u test a pickle from a previous version working? you will have to use say 0.15 and run the test script to generate data you may need to modify the test script to pickle with a freq on the Timeseries this is the generate_test_data in the pandas/io/tests/generate_legacy_pickles |
@@ -148,6 +149,21 @@ def _validate_timeseries(self, pickled, current): | |||
self.assertEqual(pickled.index.freq.normalize, False) | |||
self.assert_numpy_array_equal(pickled > 0, current > 0) | |||
|
|||
def _validate_frequency(self, pickled): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@jreback Older pickles are tested in here. Also, I've added my pickle taken in v0.15.2.
BUG: Adding nano offset raises TypeError
thanks @sinhrks |
Closes #9284.