Skip to content

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

Merged
merged 1 commit into from
Jan 25, 2015
Merged

Conversation

sinhrks
Copy link
Member

@sinhrks sinhrks commented Jan 18, 2015

Closes #9284.

@jreback jreback added Bug Frequency DateOffsets labels Jan 18, 2015
@jreback jreback added this to the 0.16.0 milestone Jan 18, 2015
@@ -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:
Copy link
Contributor

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)

@jreback
Copy link
Contributor

jreback commented Jan 25, 2015

this looks good
ready to merge?

@sinhrks
Copy link
Member Author

sinhrks commented Jan 25, 2015

Let me add explicit tests for backward compat and return type checks (pointed in #9309). I expect to finish it today.

@sinhrks
Copy link
Member Author

sinhrks commented Jan 25, 2015

@jreback It's ready. Pls review.

@jreback
Copy link
Contributor

jreback commented Jan 25, 2015

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):
Copy link
Member Author

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.

jreback added a commit that referenced this pull request Jan 25, 2015
BUG: Adding nano offset raises TypeError
@jreback jreback merged commit a557cef into pandas-dev:master Jan 25, 2015
@jreback
Copy link
Contributor

jreback commented Jan 25, 2015

thanks @sinhrks

@sinhrks sinhrks deleted the nano_add branch January 31, 2015 02:57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug Frequency DateOffsets
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Adding tseries.offsets.Nano to other offsets throws error
2 participants