cf.Data.dtype

Data.dtype

The numpy data-type of the data.

Always returned as a numpy data-type instance, but may be set as any object that converts to a numpy data-type.

Examples

>>> d = cf.Data([1, 2.5, 3.9])
>>> d.dtype
dtype('float64')
>>> print(d.array)
[1.  2.5 3.9]
>>> d.dtype = int
>>> d.dtype
dtype('int64')
>>> print(d.array)
[1 2 3]
>>> d.dtype = 'float32'
>>> print(d.array)
[1. 2. 3.]
>>> import numpy as np
>>> d.dtype = np.dtype('int32')
>>> d.dtype
dtype('int32')
>>> print(d.array)
[1 2 3]