Skip to content

Commit 71810be

Browse files
author
Ben Kandel
committed
fix errant this_columns
1 parent fc330ef commit 71810be

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed

pandas/io/parsers.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -2083,10 +2083,10 @@ def _infer_columns(self):
20832083
# We have an empty file, so check
20842084
# if columns are provided. That will
20852085
# serve as the 'line' for parsing
2086-
if have_mi_columns:
2086+
if have_mi_columns and hr > 0:
20872087
if clear_buffer:
20882088
self._clear_buffer()
2089-
columns.append([None] * len(this_columns))
2089+
columns.append([None] * len(columns[-1]))
20902090
return columns, num_original_columns
20912091

20922092
if not self.names:

pandas/parser.pyx

+1-1
Original file line numberDiff line numberDiff line change
@@ -715,7 +715,7 @@ cdef class TextReader:
715715

716716
# e.g., if header=3 and file only has 2 lines
717717
elif (self.parser.lines < hr + 1
718-
and not isinstance(self.orig_header, list)) or (
718+
and not isinstance(self.orig_header, list)) or (
719719
self.parser.lines < hr):
720720
msg = self.orig_header
721721
if isinstance(msg, list):

0 commit comments

Comments
 (0)