title: Creating Data Frame form a loop
body: <p>I need to create a dataframe from a loop. the idea is that the loop will read a data frame of texts (train_vs) and search for specific key words ['govern', 'data'] and then calculate their frequency or TF. what I want is an outcome of two columns with the TF of the words for each text inside them. the code I am using is the following:</p>
  
  <pre><code>d = pd.DataFrame()
  key = ['govern', 'data']
  for k in key:
      for w in range(0, len(train_vs)):
          wordcount = Counter(train_vs['doc_text'].iloc[w])
          a_vs = (wordcount[k]/len(train_v.iloc[w])*1)
          temp = pd.DataFrame([{k: a_vs}] )
          d = pd.concat([d, temp])
  </code></pre>
  
  <p>however, I am getting two columns but with values for the first key word and nan for second for the whole texts column and then nan for the first and values for the second again for the whole texts column. so the number of the rows of the outcome dataframe is double.</p>
  
  <p>I want to have both values next to each other.<br>
  Your help is highly appreciated.<br>
  Thanks. </p>