diff --git a/pandas/core/frame.py b/pandas/core/frame.py index b11a66c7efee9f..493cb917f88648 100644 --- a/pandas/core/frame.py +++ b/pandas/core/frame.py @@ -1959,7 +1959,7 @@ def to_stata( # mypy: Name 'statawriter' already defined (possibly by an import) from pandas.io.stata import StataWriterUTF8 as statawriter # type:ignore - kwargs: Dict[str, Any] = {} + kwargs: Dict[str, Any] = {} if version is None or version >= 117: # strl conversion is only supported >= 117 kwargs["convert_strl"] = convert_strl diff --git a/pandas/io/stata.py b/pandas/io/stata.py index cb446b0af031c3..43af5eab92d74d 100644 --- a/pandas/io/stata.py +++ b/pandas/io/stata.py @@ -12,22 +12,11 @@ from collections import abc import datetime from io import BytesIO, IOBase -from pathlib import Path import os +from pathlib import Path import struct import sys -from typing import ( - Any, - AnyStr, - BinaryIO, - Dict, - IO, - List, - Optional, - Sequence, - Tuple, - Union, -) +from typing import Any, AnyStr, BinaryIO, Dict, List, Optional, Sequence, Tuple, Union import warnings from dateutil.relativedelta import relativedelta @@ -762,7 +751,7 @@ class StataMissingValue: "float64": struct.unpack(" str: return self._str @property - def value(self) -> float: + def value(self) -> Union[int, float]: """ The binary representation of the missing value. @@ -806,7 +795,7 @@ def __eq__(self, other: Any) -> bool: ) @classmethod - def get_base_missing_value(cls, dtype: np.dtype) -> float: + def get_base_missing_value(cls, dtype: np.dtype) -> Union[int, float]: if dtype == np.int8: value = cls.BASE_MISSING_VALUES["int8"] elif dtype == np.int16: