12
12
from collections import abc
13
13
import datetime
14
14
from io import BytesIO , IOBase
15
- from pathlib import Path
16
15
import os
16
+ from pathlib import Path
17
17
import struct
18
18
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
31
20
import warnings
32
21
33
22
from dateutil .relativedelta import relativedelta
@@ -762,7 +751,7 @@ class StataMissingValue:
762
751
"float64" : struct .unpack ("<d" , float64_base )[0 ],
763
752
}
764
753
765
- def __init__ (self , value : float ):
754
+ def __init__ (self , value : Union [ int , float ] ):
766
755
self ._value = value
767
756
# Conversion to int to avoid hash issues on 32 bit platforms #8968
768
757
value = int (value ) if value < 2147483648 else float (value )
@@ -781,7 +770,7 @@ def string(self) -> str:
781
770
return self ._str
782
771
783
772
@property
784
- def value (self ) -> float :
773
+ def value (self ) -> Union [ int , float ] :
785
774
"""
786
775
The binary representation of the missing value.
787
776
@@ -806,7 +795,7 @@ def __eq__(self, other: Any) -> bool:
806
795
)
807
796
808
797
@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 ] :
810
799
if dtype == np .int8 :
811
800
value = cls .BASE_MISSING_VALUES ["int8" ]
812
801
elif dtype == np .int16 :
0 commit comments