cf.Data.tolist¶

Data.
tolist
()[source]¶ Return the data as a scalar or (nested) list.
Returns the data as an
N
levels deep nested list of Python scalars, whereN
is the number of data dimensions.If
N
is 0 then, since the depth of the nested list is 0, it will not be a list at all, but a simple Python scalar. Returns
list
or scalarThe (nested) list of array elements, or a scalar if the data has 0 dimensions.
Examples
>>> d = cf.Data(9) >>> d.tolist() 9
>>> d = cf.Data([1, 2]) >>> d.tolist() [1, 2]
>>> d = cf.Data(([[1, 2], [3, 4]])) >>> d.tolist() [[1, 2], [3, 4]]
>>> d.equals(cf.Data(d.tolist())) True