Closes #8943: COMPAT: periods needs coercion to np.int64 by Garrett-R · Pull Request #9078 · pandas-dev/pandas (original) (raw)

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 andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Conversation8 Commits1 Checks0 Files changed

Conversation

This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.Learn more about bidirectional Unicode characters

[ Show hidden characters]({{ revealButtonHref }})

@Garrett-R

Let me know if this needs any work.

closes #8943

@jreback jreback added the Compat

pandas objects compatability with Numpy or Python functions

label

Dec 16, 2014

@jreback

does the test actually trigger the error?

pls add a release note (bug fixes in v0.16.0) as well

@Garrett-R

Yes it does. In fact, it was overkill, so I simplified the test and set periods to just 10. I added some comments inside the test to explain what I'm testing for and why it overflows.

I tested it on 32-bit Linux (in VirtualBox) without the type conversions and it fails as expected.

======================================================================
FAIL: test_time_overflow_for_32bit_machines (pandas.tests.test_index.TestDatetimeIndex)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/home/garrettvb/Desktop/pandas/pandas/tests/test_index.py", line 1921, in test_time_overflow_for_32bit_machines
    self.assertEqual(len(idx1), periods)
AssertionError: 2 != 10

@Garrett-R

Also, I added "(bug fixes in v0.16.0)" to the commit message. Is that what you meant by "add a release note"?

@shoyer

@Garrett-R

Oh, haha, thanks! I'll take a look.

shoyer

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

spelling: "defatuls"

@Garrett-R

In _generate_regular_range, we explicitly cast periods to np.int64 to prevent overflow in the function tseries.index._generate_regular_range. Note: we don't bother casting it for the function call generate_range since there's no danger of overflow in that function.

@Garrett-R

Sorry about the typo. OK, hopefully everything's in order now.

shoyer added a commit that referenced this pull request

Dec 17, 2014

@shoyer

Closes #8943: COMPAT: periods needs coercion to np.int64

@shoyer

Labels

Compat

pandas objects compatability with Numpy or Python functions