Skip to content

Commit 0f0fb94

Browse files
committed
Merge pull request #7272 from neurodebian/master
BF: reading stata files - unpack read value describing stored byte order
2 parents 9480c3c + 2880181 commit 0f0fb94

File tree

2 files changed

+1
-4
lines changed

2 files changed

+1
-4
lines changed

pandas/io/stata.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -561,7 +561,7 @@ def _read_header(self):
561561
raise ValueError("Version of given Stata file is not 104, "
562562
"105, 108, 113 (Stata 8/9), 114 (Stata "
563563
"10/11), 115 (Stata 12) or 117 (Stata 13)")
564-
self.byteorder = self.path_or_buf.read(1) == 0x1 and '>' or '<'
564+
self.byteorder = struct.unpack('b', self.path_or_buf.read(1))[0] == 0x1 and '>' or '<'
565565
self.filetype = struct.unpack('b', self.path_or_buf.read(1))[0]
566566
self.path_or_buf.read(1) # unused
567567

pandas/io/tests/test_stata.py

-3
Original file line numberDiff line numberDiff line change
@@ -19,9 +19,6 @@
1919
from pandas.util.misc import is_little_endian
2020
from pandas import compat
2121

22-
if not is_little_endian():
23-
raise nose.SkipTest("known failure of test_stata on non-little endian")
24-
2522
class TestStata(tm.TestCase):
2623

2724
def setUp(self):

0 commit comments

Comments
 (0)