[Numpy-discussion] multiple 2d vs n-dimensional arrays

Adam adam at superbitbucket.com
Fri Sep 10 14:40:54 EDT 2010


  I'm keeping a large number of data points in multiple 2d arrays, for 
example:

class c(object):
     def __init__(self):
         self.a = np.zeros((24, 60))
         self.b = np.zeros((24, 60))
         ...

After processing the data, I'm serializing these to disk for future 
reference/post-processing.  It's a largish amount of data and is only 
going to get larger.

Would it be more efficient (in terms of memory/disk storage to use a 
single n-dimensional array:

         self.a = np.zeros((24, 60, 5))

What other advantages (if any) would I gain from storing the data in a 
single array rather than multiple?  The deeper into this project I get, 
the more I am probably going to need to correlate data points from one 
or more of the arrays to one or more of the other arrays.

I think I just answered my own question...

-- 
THE SuperBitBucket.com

You know you're a geek when you can hold an entire conversation with  friends in linux CLI talk, i.e. 'cat /proc/lookattheassonthat!' or 'cd /pub/beer'




More information about the NumPy-Discussion mailing list