From e2642405680294de276a276655c0150c19677e4e Mon Sep 17 00:00:00 2001 From: gfyoung Date: Wed, 14 Nov 2018 06:24:48 -0800 Subject: [PATCH] REF: Move Excel names parameter handling to CSV (#23690) --- 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 3ce8953a6edb2d..141d2c79a1927b 100644 --- a/pandas/io/excel.py +++ b/pandas/io/excel.py @@ -660,6 +660,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, @@ -681,9 +682,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)