title: Transforming a gzip file into npy file
body: <p>For my my ML model I need to open a gzip file and convert it to an array.
  My code looks like this:</p>
  
  <pre><code>def load_data(path):
      with np.load(path) as f:
          x_train, y_train = f['x_train'], f['y_train']
          x_test, y_test = f['x_test'], f['y_test']
          return (x_train, y_train), (x_test, y_test)
  
  (x_train, y_train), (x_test, y_test) = load_data('../input/mnist-numpy/mnist.npz')
  
  x_train = trainimages.reshape(trainimages.shape[0],784)
  y_train = trainimages.reshape(trainimages.shape[0],1)
  x_test = testimages.reshape(testimages.shape[0],784)
  y_test = testimages.reshape(testimages.shape[0],1)
  MNIST_image = np.vstack( (x_train,x_test) )
  MNIST_label = np.vstack( (y_train,y_test) )
  </code></pre>
  
  <p>At the moment I'm getting an error because I can't reshape the GZ file.
  Does anyone know how to create arrays or maybe there's another solution to run the code?</p>
  
  <p>My error looks like this</p>
  
  <pre><code> Traceback (most recent call last): File "&lt;ipython-input-18-c86c75005844&gt;", line 1, in &lt;module&gt; 
      x_train = trainimages.reshape(trainimages.shape[0],784) 
   AttributeError: 'GzipFile' object has no attribute 'reshape' 
  </code></pre>