title: Reshaping and applying rotations to the MNIST dataset
body: <p>I'm trying to rotate the images in the MNIST dataset (in csv) with the additional goal of recording the angles as labels (instead of the digits 0-9 as labels). I have the following steps in mind:</p>
  
  <pre><code>sample_digit = df.iloc[42].values.reshape(28,28) # reshapes 784 =&gt; 28x28
  rotated = rotate(sample_digit, angle) # rotates the reshaped data by 'angle' 
  </code></pre>
  
  <p>And this works for the above image. But what I'm looking to do, and can't seem to be able to, is loop over the df to:
  1) reshape each data point to 28x28,
  2) apply a random rotation, and
  3) record the angle Something like this:</p>
  
  <pre><code>rotated_images = []
  angles = []
  for i, row in df.itertuples():
      reshaped = row.values.reshape(28,28)
      rotated = rotate(sample_digit, angle)
      rotated_images.append(rotated)
      angles.append(angle)
  </code></pre>
  
  <p>Thanks!</p>