Skip to content

Commit

Permalink
BUG: fix python3 issues
Browse files Browse the repository at this point in the history
  • Loading branch information
wesm committed Nov 20, 2012
1 parent 57753d5 commit 61766ec
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 3 deletions.
1 change: 1 addition & 0 deletions RELEASE.rst
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ pandas 0.10.0
**Improvements to existing features**

- Grouped histogram via `by` keyword in Series/DataFrame.hist (#2186)
- Add ``nrows`` option to DataFrame.from_records for iterators (#1794)

**Bug fixes**

Expand Down
5 changes: 4 additions & 1 deletion pandas/core/frame.py
Original file line number Diff line number Diff line change
Expand Up @@ -911,7 +911,10 @@ def from_records(cls, data, index=None, exclude=None, columns=None,
return DataFrame()

try:
first_row = data.next()
if py3compat.PY3:
first_row = next(data)
else:
first_row = data.next()
except StopIteration:
return DataFrame(index=index, columns=columns)

Expand Down
4 changes: 2 additions & 2 deletions pandas/tests/test_strings.py
Original file line number Diff line number Diff line change
Expand Up @@ -710,10 +710,10 @@ def test_encode_decode_errors(self):
exp = encodeBase.map(f)
tm.assert_series_equal(result, exp)

decodeBase = Series(['a', 'b', 'a\x9d'])
decodeBase = Series([b'a', b'b', b'a\x9d'])

self.assertRaises(UnicodeDecodeError,
decodeBase.str.encode, 'cp1252')
decodeBase.str.decode, 'cp1252')

f = lambda x: x.decode('cp1252', 'ignore')
result = decodeBase.str.decode('cp1252', 'ignore')
Expand Down

0 comments on commit 61766ec

Please sign in to comment.