title: Load BeautifulSoup output into a pandas data frame - rows unknown
body: <p>I am parsing data from an HTML page.  It's in a right old mess hence I have to search through classes &amp; spans to get my data.</p>
  
  <p>I want to push the data into a data frame.</p>
  
  <p>I have the code working, however, I don't know know the number of rows in advance of creating the data frame.  To test my code I set the rows to 2000. </p>
  
  <p>I'd rather not loop through the HTML twice - is there a better way to build my data frame?</p>
  
  <pre><code>soup = BeautifulSoup(source_code, "lxml")
  new_table = pd.DataFrame(columns = range(0,3), index = range(0,2000)) # I don't know the number of rows
  
  row_marker = 0
  column_marker = 0
  
  #Column 0    
  for header in soup.find_all("div", attrs={'class':'innerListing'}):
      title = header.find("h2")
      #print (title.text.strip())
      new_table.iat[row_marker,column_marker] = title.text.strip()
      row_marker +=1
  
  column_marker = 1
  row_marker = 0
  
  #Columns 1&amp;2
  for layout in soup.find_all("div", attrs={'class':'layout'}):
      for info in layout.find_all("span", attrs={'class':'info',"id":True}):
          if "Stock" in info["id"]:
              new_table.iat[row_marker,column_marker] = info.text.strip()
              column_marker += 1
      row_marker +=1
      column_marker =1
  print(new_table)
  </code></pre>