[Numpy-discussion] numpy.savez(_compressed) in loop

2012-10-29 Thread Radek Machulka
Hi, is there a way how to save more arrays into single npy (npz if possible) file in loop? Something like: fw = open('foo.bar', 'wb') while foo: arr = np.array(bar) np.savez_compressed(fw, arr) fw.close() Or some workaround maybe? I go through hundreds of thousands arrays and ca

Re: [Numpy-discussion] Non-Zero Sub-Matrix

2010-09-10 Thread Radek Machulka
], [0, 1], [0, 0]]) R. 2010/9/10, Pauli Virtanen : > Fri, 10 Sep 2010 11:46:47 +0200, Radek Machulka wrote: >> I have array (numpy.ndarray object) with non-zero elements cumulated >> 'somewhere' (like a array([[0,0,0,0],[0,1,1,0],[0,0,1,0],[0,0,0,0]])) >

[Numpy-discussion] Non-Zero Sub-Matrix

2010-09-10 Thread Radek Machulka
Hi Folks, I have array (numpy.ndarray object) with non-zero elements cumulated 'somewhere' (like a array([[0,0,0,0],[0,1,1,0],[0,0,1,0],[0,0,0,0]])) and I need sub-array with just non-zero elements (array([[1,1],[0,1]])). I can do this with iterating throught an array, but I also found some magic