title: Can I trim data from a matrix with a partially full last row in Python?
body: <p>I am currently working with a vector of variable length (on the order of 500,000 elements) and I am trying to reshape it using numpy. My code is below. </p>
  
  <pre><code>tm = 1800 #Number of samples per row (total number of columns)
  xyzd = np.genfromtxt(filename, delimiter=',', usecols=(4,5,6,14), encoding='ISO-8859–1', skip_header=1) #reading in the data
  xtm = np.reshape(xyzd[:,0],(tm,len(xyzd)//tm+1)) #my attempt to resize
  </code></pre>
  
  <p>I get this as an error:</p>
  
  <blockquote>
    <p>ValueError: cannot reshape array of size 488200 into shape (1800,272)
    I believe this is because the reshaping leaves the last row only partially full.</p>
  </blockquote>
  
  <p>Is there a way that I can either tell reshape to only fill until it fills it's last full row and then just toss the rest of the data away or to reshape in some way that allows for it to accept that reshaped matrix, which I can then trim the last row off of.</p>