title: Reading multidimensional array data into Python
body: <p>I have data in the format of 10000x500 matrix contained in a .txt file. In each row, data points are separated from each other by one whitespace and at the end of each row there a new line starts. </p>
  
  <p>Normally I was able to read this kind of multidimensional array data into Python by using the following snippet of code:</p>
  
  <pre><code>with open("position.txt") as f:
      data = [line.split() for line in f]
  
  # Get the data and convert to floats
  ytemp = np.array(data) 
  y = ytemp.astype(np.float) 
  </code></pre>
  
  <p>This code worked until now. When I try to use the exact some code with another set of data formatted in the same way, I get the following error:</p>
  
  <blockquote>
    <p>setting an array element with a sequence.</p>
  </blockquote>
  
  <p>When I try to get the 'shape' of ytemp, it gives me the following:</p>
  
  <blockquote>
    <p>(10001,)</p>
  </blockquote>
  
  <p>So it converts the rows to array, but not the columns. </p>
  
  <p>I thought of any other information to include, but nothing came to my mind. Basically I'm trying to convert my data from a .txt file to a multidimensional array in Python. The code worked before, but now for some reason that is unclear to me it doesn't work. I tried to look compare the data, of course it's huge, but everything seems quite similar between the data that is working and the data that is not working. </p>
  
  <p>I would be more than happy to provide any other information you may need. Thanks in advance.</p>