Skip to content

Commit 1e35f87

Browse files
committed
FIX: reorder if-statements in index_label
To make sure that the newer mypy (v0.782) passes.
1 parent 080e6e1 commit 1e35f87

File tree

1 file changed

+6
-9
lines changed

1 file changed

+6
-9
lines changed

pandas/io/formats/csvs.py

+6-9
Original file line numberDiff line numberDiff line change
@@ -116,15 +116,12 @@ def index_label(self) -> IndexLabel:
116116

117117
@index_label.setter
118118
def index_label(self, index_label: IndexLabel) -> None:
119-
if index_label is False:
120-
self._index_label = index_label
121-
return
122-
123-
if index_label is None:
124-
index_label = self._get_index_label_from_obj()
125-
elif not isinstance(index_label, (list, tuple, np.ndarray, ABCIndexClass)):
126-
# given a string for a DF with Index
127-
index_label = [index_label]
119+
if index_label is not False:
120+
if index_label is None:
121+
index_label = self._get_index_label_from_obj()
122+
elif not isinstance(index_label, (list, tuple, np.ndarray, ABCIndexClass)):
123+
# given a string for a DF with Index
124+
index_label = [index_label]
128125
self._index_label = index_label
129126

130127
def _get_index_label_from_obj(self):

0 commit comments

Comments
 (0)