mirror of
https://github.com/p2p-ld/numpydantic.git
synced 2024-11-12 17:54:29 +00:00
add datetime to maps
This commit is contained in:
parent
44da36407d
commit
0d5e4cf555
2 changed files with 10 additions and 0 deletions
|
@ -64,5 +64,6 @@ python_to_nptyping = {
|
|||
int: dt.Int,
|
||||
bool: dt.Bool,
|
||||
complex: dt.Complex,
|
||||
datetime: np.datetime64,
|
||||
}
|
||||
"""Map from python types to nptyping types"""
|
||||
|
|
|
@ -135,6 +135,15 @@ class NDArrayMeta(_NDArrayMeta, implementation="NDArray"):
|
|||
)
|
||||
return dtype
|
||||
|
||||
def _dtype_to_str(cls, dtype: Any) -> str:
|
||||
if dtype is Any:
|
||||
result = "Any"
|
||||
elif issubclass(dtype, Structure):
|
||||
result = str(dtype)
|
||||
elif isinstance(dtype, tuple):
|
||||
result = ", ".join([str(dt) for dt in dtype])
|
||||
return result
|
||||
|
||||
|
||||
class NDArray(NPTypingType, metaclass=NDArrayMeta):
|
||||
"""
|
||||
|
|
Loading…
Reference in a new issue