diff --git a/pandas/core/arrays/sparse/dtype.py b/pandas/core/arrays/sparse/dtype.py index 3b656705f5568..0124304727ab3 100644 --- a/pandas/core/arrays/sparse/dtype.py +++ b/pandas/core/arrays/sparse/dtype.py @@ -1,7 +1,7 @@ """Sparse Dtype""" import re -from typing import Any +from typing import Any, Tuple import numpy as np @@ -223,7 +223,7 @@ def construct_from_string(cls, string): raise TypeError(msg) @staticmethod - def _parse_subtype(dtype): + def _parse_subtype(dtype: str) -> Tuple[str, bool]: """ Parse a string to get the subtype @@ -249,7 +249,7 @@ def _parse_subtype(dtype): has_fill_value = False if m: subtype = m.groupdict()["subtype"] - has_fill_value = m.groupdict()["fill_value"] or has_fill_value + has_fill_value = bool(m.groupdict()["fill_value"]) elif dtype == "Sparse": subtype = "float64" else: