title: PYTHON: How do deal with data types after np.fromfile (binary format) correctly?
body: <p>I have various problems with my assigned data types after read from any binary file with <code>np.fromfile</code> and <code>np.memmap</code>.</p>
  
  <p>I am reading the following:</p>
  
  <pre><code>openfile = open(mypath,'rb')
  openfile.seek(start_byte)
  myvalue = np.fromfile(openfile, dtype = np.uint64, count=1)
  
  print myvalue
  </code></pre>
  
  <p>return:</p>
  
  <pre><code>myvalue = [1234]
  </code></pre>
  
  <p><code>myvalue</code> has 8 bytes and is interpreted as an ndarray, but I want just an uint64-value using it as an index.</p>
  
  <p><strong>1) How to prevent np.fromfile to write in an ndarray?</strong></p>
  
  <p>If I am trying: <code>myvalue = myvalue[0]</code> <code>myvalue</code> loses it's data type completely.</p>
  
  <p><strong>2) Why does <code>myvalue</code> looses it's data type when I am accessing the first</strong> </p>
  
  <p>I have to do something like that with my arrays:</p>
  
  <pre><code>data.extend([myvalue for l in range(myvalue)])
  </code></pre>
  
  <p>Try to assign again a data type: <code>myvalue = myvalue[0].astype(np.uint64)</code>. Now I get: </p>
  
  <pre><code>self.data_array[count:count+myvalue,0] = data[count:count+myvalue]   
  TypeError: slice indices must be integers or None or have an __index__ method
  </code></pre>
  
  <p><strong>3) What is going wrong here?</strong></p>
  
  <p>If I am assigning myvalue as: <code>myvalue = myvalue[0].astype(np.int32)</code> The data is interpreted wrongly and I get: <code>-35566848567</code> etc.</p>
  
  <p><strong>4) Why can myvalue still be wrongly interpreted by the programme after read in since</strong>
  <code>myvalue = myvalue[0].astype(np.int32)</code><br>
  <strong>IS NOT</strong>
  <code>myvalue = myvalue[0].astype(np.uint64)</code></p>