cf.Data.tolist

Data.tolist()[source]

Return the array as a (possibly nested) list.

Return a copy of the array data as a (nested) Python list. Data items are converted to the nearest compatible Python type.

Returns
list

The possibly nested list of array elements.

Examples:

>>> d = cf.Data([1, 2])
>>> d.tolist()
[1, 2]
>>> d = cf.Data(([[1, 2], [3, 4]])
>>> list(d)
[array([1, 2]), array([3, 4])]      # DCH CHECK
>>> d.tolist()
[[1, 2], [3, 4]]
>>> d.equals(cf.Data(d.tolist()))
True