Skip to content

Commit

Permalink
TYP: alias IndexLabel without Optional (pandas-dev#36401)
Browse files Browse the repository at this point in the history
  • Loading branch information
ivanovmg authored and rhshadrach committed Sep 17, 2020
1 parent 84614d2 commit 44f0c5f
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion pandas/_typing.py
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@

Axis = Union[str, int]
Label = Optional[Hashable]
IndexLabel = Optional[Union[Label, Sequence[Label]]]
IndexLabel = Union[Label, Sequence[Label]]
Level = Union[Label, int]
Ordered = Optional[bool]
JSONSerializable = Optional[Union[PythonScalar, List, Dict]]
Expand Down
2 changes: 1 addition & 1 deletion pandas/core/generic.py
Original file line number Diff line number Diff line change
Expand Up @@ -3154,7 +3154,7 @@ def to_csv(
columns: Optional[Sequence[Label]] = None,
header: Union[bool_t, List[str]] = True,
index: bool_t = True,
index_label: IndexLabel = None,
index_label: Optional[IndexLabel] = None,
mode: str = "w",
encoding: Optional[str] = None,
compression: CompressionOptions = "infer",
Expand Down
4 changes: 2 additions & 2 deletions pandas/io/formats/csvs.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ def __init__(
cols: Optional[Sequence[Label]] = None,
header: Union[bool, Sequence[Hashable]] = True,
index: bool = True,
index_label: IndexLabel = None,
index_label: Optional[IndexLabel] = None,
mode: str = "w",
encoding: Optional[str] = None,
errors: str = "strict",
Expand Down Expand Up @@ -100,7 +100,7 @@ def index_label(self) -> IndexLabel:
return self._index_label

@index_label.setter
def index_label(self, index_label: IndexLabel) -> None:
def index_label(self, index_label: Optional[IndexLabel]) -> None:
if index_label is not False:
if index_label is None:
index_label = self._get_index_label_from_obj()
Expand Down

0 comments on commit 44f0c5f

Please sign in to comment.