Skip to content

Commit fc23e5c

Browse files
author
Ben Kandel
committed
fix errant this_columns
1 parent 3d9bbdd commit fc23e5c

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
@@ -718,7 +718,7 @@ cdef class TextReader:
718718

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

0 commit comments

Comments
 (0)