Skip to content

Commit 5eb72ea

Browse files
committed
BUG: don't hash dtype because of endianness confusion re: #748 and #747
1 parent 6c31cab commit 5eb72ea

File tree

3 files changed

+8
-6
lines changed

3 files changed

+8
-6
lines changed

pandas/core/frame.py

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1082,11 +1082,12 @@ def convert_objects(self):
10821082
def get_dtype_counts(self):
10831083
counts = {}
10841084
for _, series in self.iterkv():
1085-
if series.dtype in counts:
1086-
counts[series.dtype] += 1
1085+
# endianness can cause dtypes to look different
1086+
dtype_str = str(series.dtype)
1087+
if dtype_str in counts:
1088+
counts[dtype_str] += 1
10871089
else:
1088-
counts[series.dtype] = 1
1089-
1090+
counts[dtype_str] = 1
10901091
return Series(counts)
10911092

10921093
#----------------------------------------------------------------------

pandas/core/internals.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -382,7 +382,7 @@ def is_consolidated(self):
382382
"""
383383
Return True if more than one block with the same dtype
384384
"""
385-
dtypes = [blk.dtype for blk in self.blocks]
385+
dtypes = [blk.dtype.type for blk in self.blocks]
386386
return len(dtypes) == len(set(dtypes))
387387

388388
def get_slice(self, slobj, axis=0):

pandas/tools/tests/test_merge.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -345,7 +345,7 @@ def test_join_unconsolidated(self):
345345
a = DataFrame(randn(30,2), columns=['a','b'])
346346
c = Series(randn(30))
347347
a['c'] = c
348-
d = DataFrame(randn(30,1), columns=['d'])
348+
d = DataFrame(randn(30,1), columns=['q'])
349349

350350
# it works!
351351
a.join(d)
@@ -505,6 +505,7 @@ def test_merge_nocopy(self):
505505
merged['d'] = 'peekaboo'
506506
self.assert_((right['d'] == 'peekaboo').all())
507507

508+
508509
class TestMergeMulti(unittest.TestCase):
509510

510511
def setUp(self):

0 commit comments

Comments
 (0)