Skip to content

Commit 26f807c

Browse files
committed
Merge pull request #4923 from jtratner/simplify-next-in-fwf
CLN: Remove py3 next method from FixedWidthReader
2 parents ea63f36 + 78c76d9 commit 26f807c

File tree

1 file changed

+5
-14
lines changed

1 file changed

+5
-14
lines changed

pandas/io/parsers.py

Lines changed: 5 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1964,20 +1964,11 @@ def __init__(self, f, colspecs, filler, thousands=None, encoding=None):
19641964
isinstance(colspec[1], int) ):
19651965
raise AssertionError()
19661966

1967-
if compat.PY3:
1968-
def next(self):
1969-
line = next(self.f)
1970-
if isinstance(line, bytes):
1971-
line = line.decode(self.encoding)
1972-
# Note: 'colspecs' is a sequence of half-open intervals.
1973-
return [line[fromm:to].strip(self.filler or ' ')
1974-
for (fromm, to) in self.colspecs]
1975-
else:
1976-
def next(self):
1977-
line = next(self.f)
1978-
# Note: 'colspecs' is a sequence of half-open intervals.
1979-
return [line[fromm:to].strip(self.filler or ' ')
1980-
for (fromm, to) in self.colspecs]
1967+
def next(self):
1968+
line = next(self.f)
1969+
# Note: 'colspecs' is a sequence of half-open intervals.
1970+
return [line[fromm:to].strip(self.filler or ' ')
1971+
for (fromm, to) in self.colspecs]
19811972

19821973
# Iterator protocol in Python 3 uses __next__()
19831974
__next__ = next

0 commit comments

Comments
 (0)