title: Creating an Array from a text file with more than one data type in Python
body: <p>I am trying to create an array from a text file with both numbers and letters (as a header), however when I try to convert and open my file I end up getting the error:</p>
  
  <blockquote>
    <p>ValueError: invalid literal for float(): 0</p>
  </blockquote>
  
  <p>or</p>
  
  <blockquote>
    <p>ValueError: could not convert string to float: AA</p>
  </blockquote>
  
  <p>I understand that this is a data type problem and was wondering if anyone knew a way around this? I'm new to python and usually code in Matlab. my text file consists of: </p>
  
  <pre><code>AA, AB, AC, AD, AE, AF, AG, AH, AI
  0, 1, 0, 1, 1, 0, 1, 0, 0
  </code></pre>
  
  <p>and the code I have tried is below</p>
  
  <pre><code>import numpy as np
  a = np.loadtxt('test.txt')
  print 
  </code></pre>
  
  <p>After that, I need to cut all the columns that have zeroes and keep the ones that have 1s in them. The text files to be loaded in will be different each time and I only need to see which cells and headers have been populated with a 1.</p>