Skip to content

Commit 61766ec

Browse files
committed
BUG: fix python3 issues
1 parent 57753d5 commit 61766ec

File tree

3 files changed

+7
-3
lines changed

3 files changed

+7
-3
lines changed

RELEASE.rst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,7 @@ pandas 0.10.0
4141
**Improvements to existing features**
4242

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

4546
**Bug fixes**
4647

pandas/core/frame.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -911,7 +911,10 @@ def from_records(cls, data, index=None, exclude=None, columns=None,
911911
return DataFrame()
912912

913913
try:
914-
first_row = data.next()
914+
if py3compat.PY3:
915+
first_row = next(data)
916+
else:
917+
first_row = data.next()
915918
except StopIteration:
916919
return DataFrame(index=index, columns=columns)
917920

pandas/tests/test_strings.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -710,10 +710,10 @@ def test_encode_decode_errors(self):
710710
exp = encodeBase.map(f)
711711
tm.assert_series_equal(result, exp)
712712

713-
decodeBase = Series(['a', 'b', 'a\x9d'])
713+
decodeBase = Series([b'a', b'b', b'a\x9d'])
714714

715715
self.assertRaises(UnicodeDecodeError,
716-
decodeBase.str.encode, 'cp1252')
716+
decodeBase.str.decode, 'cp1252')
717717

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

0 commit comments

Comments
 (0)