Skip to content

BF: reading stata files - unpack read value describing stored byte order #7272

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

Merged
merged 1 commit into from
May 29, 2014
Merged
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
2 changes: 1 addition & 1 deletion pandas/io/stata.py
Original file line number Diff line number Diff line change
Expand Up @@ -561,7 +561,7 @@ def _read_header(self):
raise ValueError("Version of given Stata file is not 104, "
"105, 108, 113 (Stata 8/9), 114 (Stata "
"10/11), 115 (Stata 12) or 117 (Stata 13)")
self.byteorder = self.path_or_buf.read(1) == 0x1 and '>' or '<'
self.byteorder = struct.unpack('b', self.path_or_buf.read(1))[0] == 0x1 and '>' or '<'
self.filetype = struct.unpack('b', self.path_or_buf.read(1))[0]
self.path_or_buf.read(1) # unused

Expand Down
3 changes: 0 additions & 3 deletions pandas/io/tests/test_stata.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,6 @@
from pandas.util.misc import is_little_endian
from pandas import compat

if not is_little_endian():
raise nose.SkipTest("known failure of test_stata on non-little endian")

class TestStata(tm.TestCase):

def setUp(self):
Expand Down