Skip to content

Commit

Permalink
BUG: Swap byteorder in constructor of Block Manager (pandas-dev#4737)
Browse files Browse the repository at this point in the history
  • Loading branch information
MHC03 committed Aug 11, 2018
1 parent 0370740 commit ea0a392
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion pandas/core/internals/managers.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
import itertools
import operator
import re
import sys

import numpy as np

Expand Down Expand Up @@ -106,7 +107,12 @@ class BlockManager(PandasObject):

def __init__(self, blocks, axes, do_integrity_check=True):
self.axes = [ensure_index(ax) for ax in axes]
self.blocks = tuple(blocks)

non_native_byteorder = '>' if sys.byteorder == 'little' else '<'
self.blocks = tuple(block.astype(block.dtype.newbyteorder('='))
if non_native_byteorder in str(block.dtype)
else block
for block in blocks)

for block in blocks:
if block.is_sparse:
Expand Down

0 comments on commit ea0a392

Please sign in to comment.