Skip to content

Commit 9fb0478

Browse files
committed
CLN: Restore Union[int, float]
1 parent 85639b5 commit 9fb0478

File tree

2 files changed

+6
-17
lines changed

2 files changed

+6
-17
lines changed

pandas/core/frame.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -1959,7 +1959,7 @@ def to_stata(
19591959
# mypy: Name 'statawriter' already defined (possibly by an import)
19601960
from pandas.io.stata import StataWriterUTF8 as statawriter # type:ignore
19611961

1962-
kwargs: Dict[str, Any] = {}
1962+
kwargs: Dict[str, Any] = {}
19631963
if version is None or version >= 117:
19641964
# strl conversion is only supported >= 117
19651965
kwargs["convert_strl"] = convert_strl

pandas/io/stata.py

+5-16
Original file line numberDiff line numberDiff line change
@@ -12,22 +12,11 @@
1212
from collections import abc
1313
import datetime
1414
from io import BytesIO, IOBase
15-
from pathlib import Path
1615
import os
16+
from pathlib import Path
1717
import struct
1818
import sys
19-
from typing import (
20-
Any,
21-
AnyStr,
22-
BinaryIO,
23-
Dict,
24-
IO,
25-
List,
26-
Optional,
27-
Sequence,
28-
Tuple,
29-
Union,
30-
)
19+
from typing import Any, AnyStr, BinaryIO, Dict, List, Optional, Sequence, Tuple, Union
3120
import warnings
3221

3322
from dateutil.relativedelta import relativedelta
@@ -762,7 +751,7 @@ class StataMissingValue:
762751
"float64": struct.unpack("<d", float64_base)[0],
763752
}
764753

765-
def __init__(self, value: float):
754+
def __init__(self, value: Union[int, float]):
766755
self._value = value
767756
# Conversion to int to avoid hash issues on 32 bit platforms #8968
768757
value = int(value) if value < 2147483648 else float(value)
@@ -781,7 +770,7 @@ def string(self) -> str:
781770
return self._str
782771

783772
@property
784-
def value(self) -> float:
773+
def value(self) -> Union[int, float]:
785774
"""
786775
The binary representation of the missing value.
787776
@@ -806,7 +795,7 @@ def __eq__(self, other: Any) -> bool:
806795
)
807796

808797
@classmethod
809-
def get_base_missing_value(cls, dtype: np.dtype) -> float:
798+
def get_base_missing_value(cls, dtype: np.dtype) -> Union[int, float]:
810799
if dtype == np.int8:
811800
value = cls.BASE_MISSING_VALUES["int8"]
812801
elif dtype == np.int16:

0 commit comments

Comments
 (0)