What's the best way to assert DataArray's dtype? #4856
-
yields False so I was wondering what's the proper way to check?
|
Beta Was this translation helpful? Give feedback.
Answered by
andersy005
Feb 1, 2021
Replies: 1 comment 3 replies
-
It's my understanding that due to the complexity of hierarchy of type objects in Numpy, using In [18]: np.issubdtype(ds.air.dtype, np.float32)
Out[18]: True
In [19]: np.issubdtype(ds.time.dtype, np.datetime64)
Out[19]: True |
Beta Was this translation helpful? Give feedback.
3 replies
Answer selected by
dcherian
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
It's my understanding that due to the complexity of hierarchy of type objects in Numpy, using
np.issubdtype()
is more reliable/robust than.isinstance()
: