def get_pandas_dtypes(dtypes: dict[str, Type[Any]]) -> dict[str, str]:
"""isinstance
Args:
dtypes (dict[str, Type[Any]]): dtypes
Returns:
T: value
"""
uint_types = [np.uint8, np.uint16, np.uint32, np.uint64]
int_types = [int, np.int8, np.int16, np.int32, np.int64]
float_types = [float, np.float16, np.float32, np.float64]
complex_types = [complex, np.complex64, np.complex128]
pandas_dtypes: dict[str, str] = {}
for k, v in dtypes.items():
if v is StrictInt:
pandas_dtypes[k] = "int"
elif v is StrictFloat:
pandas_dtypes[k] = "float"
elif v in (bool, StrictBool):
pandas_dtypes[k] = "boolean"
elif v in (str, StrictStr):
pandas_dtypes[k] = "string"
elif v in (datetime.date, datetime.datetime):
pandas_dtypes[k] = "datetime64[ns]"
elif v is datetime.timedelta:
pandas_dtypes[k] = "timedelta64[ns]"
elif v in uint_types + int_types + float_types + complex_types:
pandas_dtypes[k] = v.__name__
else:
pandas_dtypes[k] = "object"
return pandas_dtypes