diff --git a/pandas/core/frame.py b/pandas/core/frame.py index 19f15f58afffd..80edfa2af024e 100644 --- a/pandas/core/frame.py +++ b/pandas/core/frame.py @@ -794,10 +794,7 @@ def from_records(cls, data, index=None, exclude=None, columns=None, return cls() try: - if compat.PY3: - first_row = next(data) - else: - first_row = next(data) + first_row = next(data) except StopIteration: return cls(index=index, columns=columns)