title: How to fix tuple index out of range error in Python?
body: <p>I have been working on music genre classification code by <code>[Matan Lachmish][1]</code>
  Upon running his code for training a neural net (<code>[train.py][2]</code>).
  I am running into a problem.</p>
  
  <p>Input files for the code are "data" and "labels" which both contain binary data. The code runs into an error after loading the data file when I am reshaping it.The code looks like this </p>
  
  <pre><code># Load data
  data = []
  with open("data",'rb') as f:
      content = f.read()
      data = pickle.loads(content)
  data = np.asarray(data)
  data = data
  data = data.reshape((data.shape[0], n_input))
  </code></pre>
  
  <p>The Traceback goes like this</p>
  
  <pre><code> Traceback (most recent call last):
    File "train.py", line 49, in &lt;module&gt;
     data = data.reshape((data.shape[0], n_input))
  IndexError: tuple index out of range
  </code></pre>
  
  <p>Dataset used (Million Song Dataset)</p>
  
  <p>A snippet from labels file</p>
  
  <pre><code>8003 636e 756d 7079 2e63 6f72 652e 6d75
  6c74 6961 7272 6179 0a5f 7265 636f 6e73
  7472 7563 740a 7100 636e 756d 7079 0a6e
  6461 7272 6179 0a71 014b 0085 7102 4301
  6271 0387 7104 5271 0528 4b01 4b64 4b0a
  8671 0663 6e75 6d70 790a 6474 7970 650a
  7107 5802 0000 0069 3471 084b 004b 0187
  7109 5271 0a28 4b03 5801 0000 003c 710b
  4e4e 4e4a ffff ffff 4aff ffff ff4b 0074
  710c 6289 42a0 0f00 0001 0000 0000 0000
  0000 0000 0000 0000 0000 0000 0000 0000
  0000 0000 0000 0000 0000 0000 0000 0000
  0001 0000 0000 0000 0000 0000 0000 0000
  0000 0000 0000 0000 0000 0000 0000 0000
  </code></pre>