0

I have a h5py data that looks like this.

import h5py
f = h5py.File('X.h5', 'w')
f['X'] = np.array([[0, 0], [0, 1], [1, 0], [1, 1]])
>>> f['X'][...]
    array([[0, 0],
           [0, 1],
           [1, 0],
           [1, 1]])

I want transpose of above data. It might be easy for small data, but what if I have very huge data?

Cleb
  • 25,102
  • 20
  • 116
  • 151
Kavan
  • 331
  • 1
  • 4
  • 13
  • 1
    Does `np.transpose` do the job? – hpaulj Mar 21 '16 at 16:56
  • Do you want a transposed numpy array held in memory, or do you actually want to transpose the data stored on disk? – ali_m Mar 21 '16 at 20:27
  • I want transpose of data stored on disk @ali_m – Kavan Mar 30 '16 at 18:08
  • 1
    How much RAM do you have and what are the `.shape`, `.dtype` and `.chunks` attributes of your dataset? Can I also ask why you want to transpose the data on disk, rather than simply changing the way you index into it? – ali_m Apr 01 '16 at 12:48
  • Transposing a matrix means rearranging the elements. This will take a read and a write. For very huge data you will need very huge memory or a lot time (read in strides). As ali_m or hpaulj say, use something different like a view or transpose after reading only. – NoDataDumpNoContribution Jun 16 '16 at 09:33

0 Answers0