The .tolist() method does not work on a quantity derived from a single numpy value (rather than an array). The same method does work on all numpy values, regardless of whether they are lists. Other packages like jsonpickle depend on this behavior working.
import sys
sys.path.insert(0, '/home/rgerkin/Dropbox/dev/quantities')
import numpy as np
import quantities as pq
x = np.array([1.0, 2.0])
y = np.array(3.0)
x.tolist() # Works fine
y.tolist() # Works fine
(x * pq.V).tolist() # Works fine
(y * pq.V).tolist() # Throws exception
The
.tolist()method does not work on a quantity derived from a single numpy value (rather than an array). The same method does work on all numpy values, regardless of whether they are lists. Other packages likejsonpickledepend on this behavior working.