diff --git a/pandas/io/parsers.py b/pandas/io/parsers.py index 13b67068985f3..3fe5e5e826ebd 100755 --- a/pandas/io/parsers.py +++ b/pandas/io/parsers.py @@ -1512,7 +1512,8 @@ def read(self, nrows=None): index, columns, col_dict = _get_empty_meta( names, self.index_col, self.index_names, dtype=self.kwds.get('dtype')) - columns = self._maybe_make_multi_index_columns(columns, self.col_names) + columns = self._maybe_make_multi_index_columns( + columns, self.col_names) if self.usecols is not None: columns = self._filter_usecols(columns) @@ -1979,9 +1980,10 @@ def read(self, rows=None): if not len(content): # pragma: no cover # DataFrame with the right metadata, even though it's length 0 names = self._maybe_dedup_names(self.orig_names) - index, columns, col_dict = _get_empty_meta(names, self.index_col, - self.index_names) - columns = self._maybe_make_multi_index_columns(columns, self.col_names) + index, columns, col_dict = _get_empty_meta( + names, self.index_col, self.index_names) + columns = self._maybe_make_multi_index_columns( + columns, self.col_names) return index, columns, col_dict # handle new style for names in index diff --git a/pandas/io/tests/parser/common.py b/pandas/io/tests/parser/common.py index 941cd9db8c71a..6eb73876c11dd 100644 --- a/pandas/io/tests/parser/common.py +++ b/pandas/io/tests/parser/common.py @@ -621,14 +621,13 @@ def test_multi_index_blank_df(self): c,d """ df2 = self.read_csv(StringIO(data_multiline), header=[0, 1]) - cols = MultiIndex.from_tuples([('a','c'), ('b', 'd')]) + cols = MultiIndex.from_tuples([('a', 'c'), ('b', 'd')]) expected2 = DataFrame(columns=cols) tm.assert_frame_equal(df2, expected2) round_trip = self.read_csv(StringIO( expected2.to_csv(index=False)), header=[0, 1]) tm.assert_frame_equal(round_trip, expected2) - def test_no_unnamed_index(self): data = """ id c0 c1 c2 0 1 0 a b