From 38352ea4650ce71947ddda0ac9fda63c12124cc8 Mon Sep 17 00:00:00 2001 From: gfyoung Date: Wed, 14 Nov 2018 01:05:06 -0800 Subject: [PATCH] REF: Move Excel names parameter handling to CSV Let the CSV TextFileParser do the work. No need to duplicate it in the ExcelFile class. --- pandas/io/excel.py | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/pandas/io/excel.py b/pandas/io/excel.py index a7e0e48de0a75..2b964a88a9695 100644 --- a/pandas/io/excel.py +++ b/pandas/io/excel.py @@ -651,6 +651,7 @@ def _parse_cell(cell_contents, cell_typ): # GH 12292 : error when read one empty column from excel file try: parser = TextParser(data, + names=names, header=header, index_col=index_col, has_index_names=has_index_names, @@ -671,9 +672,6 @@ def _parse_cell(cell_contents, cell_typ): output[asheetname] = parser.read(nrows=nrows) - if names is not None: - output[asheetname].columns = names - if not squeeze or isinstance(output[asheetname], DataFrame): output[asheetname].columns = output[ asheetname].columns.set_names(header_names)