title: Using numpy fromfile on binary file returns 1 dimension ndarray
body: <p>I'm using numpy's fromfile function to read data from a binary file. The file contains a sequence of values (3 * float32, 3 * int8, 3 * float32) which I want to extract into a numpy ndarray with (rows, 9) shape.</p>
  
  <pre><code>with open('file/path', 'rb') as my_file:
      my_dtype = np.dtype('&gt;f4, &gt;f4, &gt;f4, &gt;i1, &gt;i1, &gt;i1, &gt;f4, &gt;f4, &gt;f4' )
      my_array = np.fromfile( my_file, dtype = my_dtype )
  
      print(my_array.shape)
      print(type(my_array[0]))
      print(my_array[0])
  </code></pre>
  
  <p>And this returns:</p>
  
  <pre><code>(38475732,)
  &lt;type 'numpy.void'&gt;
  (-775.0602416992188, -71.0, -242.5240020751953, 39, 39, 39, 5.0, 2753.0, 15328.0)
  </code></pre>
  
  <ol>
  <li><p>How can I get a 2 dimensional ndarray with shape (38475732, 9,)? </p></li>
  <li><p>Why the returned tuple is of type 'numpy.void'?</p></li>
  </ol>
  
  <p><b>Redefining question:</b></p>
  
  <p>If all the values that I want to read from the file were, for example, 4 byte floats I would use np.dtype('9>f4') and I would get what I need. But, as my binary file contains different types, is there a way of casting all the values into 32bit floats?</p>
  
  <p>PS: I can do this using 'struct' to parse the binary file into a list and converting this list into an ndarray afterwards, but this method is much slower than using np.fromfile</p>
  
  <p><b>Solution:</b></p>
  
  <p>Thanks Hpaulj for your answer! What I did in my code was to add the following line to do the conversion from the recarray returned by the numpy fromfile function to the expected ndarray:</p>
  
  <pre><code>my_array = my_array.astype('f4, f4, f4, f4, f4, f4, f4, f4, f4').view(dtype='f4').reshape(my_array.shape[0], 9)
  </code></pre>
  
  <p>Which returns a (38475732, 9) ndarray</p>
  
  <p>Cheers!</p>