title: JSONDecodeError: Expecting value: line 1 column 1 (char 0) in Panda's For Loop
body: <p>By iterating through a for loop in pandas, I created matrices with the same information for both the rows and columns.</p>
  
  <p>Here is my current code:</p>
  
  <pre><code>for i in range(60):
  
  eachMatrix = pd.DataFrame(index=df.WordTeams[i],columns=df.WordTeams[i])
  eachMatrixcols = eachMatrix.columns.values
  eachMatrixIndex = eachMatrix.index.values
  for values in eachMatrixcols:
      for words in eachMatrixIndex:
          if values == words:
              eachMatrix.loc[words, values] = 0
          else:
              urlVector = requests.get( "XXXX?resp=" + values + "&amp;modResp=" + words)
              loaded = json.loads(urlVector.text)
              print(loaded)
  </code></pre>
  
  <p>They look like this for example:</p>
  
  <pre><code>     dog cat med sox
   dog 0   NAN NAN NAN
   cat NAN 0   NAN NAN
   med NAN NAN 0   NAN
   sox NAN NAN NAN 0
  </code></pre>
  
  <p>The numbers denote the semantic distance between the words. To fill the NAN values, I am making a call to an API with the two words (dog and cat for example). The API works when I try it outside of my for loop or in the browser, but for some reason returns this error when called in my loop</p>
  
  <pre><code>JSONDecodeError: Expecting value: line 1 column 1 (char 0)
  </code></pre>
  
  <p>Traceback error:</p>
  
  <pre><code>JSONDecodeError                           Traceback (most recent call last)
  &lt;ipython-input-3-0c4507581e84&gt; in &lt;module&gt;()
   14             else:
   15                 urlVector = requests.get( "http://52.7.88.187/DSCoVAR-NLP/w2vScore.php?resp=" + values + "&amp;modResp=" + words)
   16                 loaded = json.loads(urlVector.text)
   17                 print(loaded)
   18 
  </code></pre>
  
  <p>I tried try/except clauses and it would only return a number for the first api call and then execute the except. Anyone know why this may be happening?</p>