Skip to content

BF: define expected Series of correct for arch (eg i386) int #15044

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

Closed
wants to merge 2 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions pandas/tests/indexes/common.py
Original file line number Diff line number Diff line change
Expand Up @@ -127,6 +127,13 @@ def test_ndarray_compat_properties(self):

values = idx.values
for prop in self._compat_props:
# skip equivalency check if converted type is object, as happens
# for PeriodIndex, since then object (address) would be 4 bytes
# on 32bit platforms and equivalence to int64 of original
# date time is just accidental
if prop in ('itemsize', 'nbytes') \
and values.dtype.name == 'object':
continue
Copy link
Contributor Author

Choose a reason for hiding this comment

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

@jreback - I have added one more "skip" which was failing on i386 -- described "incode". Does it make sense? ;)

Copy link
Contributor

Choose a reason for hiding this comment

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

ok this is fine

self.assertEqual(getattr(idx, prop), getattr(values, prop))

# test for validity
Expand Down
5 changes: 4 additions & 1 deletion pandas/tools/tests/test_tile.py
Original file line number Diff line number Diff line change
Expand Up @@ -288,7 +288,10 @@ def test_qcut_duplicates_bin(self):

def test_single_bin(self):
# issue 14652
expected = Series([0, 0])
# Explicit dtype since Series produces int64 for ints, while cut
# (due to numpy.searchsorted) would use int32 on i386, so let's assure
# correct default to the architecture int
Copy link
Contributor

Choose a reason for hiding this comment

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

we don't test on 32-bit, but if this works that is ok

specify dtype='intp' here

Copy link
Contributor

Choose a reason for hiding this comment

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

though this works fine on windows now (e.g. 64-bit points on 32-bit systems).

and are you on master? this looks like an older line number.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Copy link
Contributor Author

Choose a reason for hiding this comment

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

now with 'intp'

Copy link
Contributor

Choose a reason for hiding this comment

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

actually I think this is a bug, cut on ints should always be 64-bit regardless of arch.

Copy link
Contributor

Choose a reason for hiding this comment

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

https://github.com/pandas-dev/pandas/blob/master/pandas/tools/tile.py#L218

needs an .astype('int64', copy=False) as these can get returned to the user in some paths; and they are 32-bit on 32-bit :< (while 64bit on others)

expected = Series([0, 0], dtype='intp')

s = Series([9., 9.])
result = cut(s, 1, labels=False)
Expand Down