title: Converting pandas data frame into numpy ndarray
body: <p>I am using a pandas data frame to clean and process data. However, I need to then convert it into a numpy ndarray in order to use exploit matrix multiplication. I turn the data frame into a list of lists with the following:</p>
  
  <pre><code>x = df.tolist()
  </code></pre>
  
  <p>This returns the following structure:</p>
  
  <pre><code>[[1, 2], [3, 4], [5, 6], [7, 8] ...]
  </code></pre>
  
  <p>I then convert it into a numpy array like this:</p>
  
  <pre><code>x = np.array(x)
  </code></pre>
  
  <p>However, the following print:</p>
  
  <pre><code>print(type(x))
  print(type(x[0]))
  </code></pre>
  
  <p>gives this result:</p>
  
  <pre><code>'numpy.ndarray'
  'numpy.float64'
  </code></pre>
  
  <p>However, I need them both to be numpy arrays. If it's not from a pandas data frame and I just convert a hard-coded list of lists then they are both ndarrays. How do I get the list, and the lists in that list to be ndarrays when that list has been made from a data frame? Many thanks for reading, this has had me stumped for hours.   </p>