I've read here that creating a list of lists is much faster than creating a NumPy array. However, I also read (somewhere on Stack Overflow but I'm not sure where exactly) that, to retrieve a value from an array, [i, j]
is faster than [i][j]
- I could use the former in a NumPy array, but I'd have to use the latter in a list of lists. So it seems that storing the data is quicker in a nested list, but retrieving the data is quicker in a NumPy array.
I'm guessing that one method is overall quicker than the other, so which one is it, and why?
(I want to do calculations with the stored data later, so the speed at which I retrieve the data matters, but they'll all be elementwise, so an array and a list of lists would both be ok.)