title: Parsing multiple tables with BeautifulSoup
body: <p>I'm having problems parsing table data with BeautifulSoup, though I've tried many solutions found <a href="https://stackoverflow.com/questions/23377533/python-beautifulsoup-parsing-table">here</a>, <a href="https://stackoverflow.com/questions/28291700/python-beautifulsoup-parsing-multiple-tables-with-same-class-name">here</a>, and <a href="https://stackoverflow.com/questions/27485854/scraping-different-table-with-same-classes-with-beautifulsoup-python?rq=1">here</a>. I hate to re-ask but maybe my issue is unique and that is why the above solutions haven't worked, or I'm just an idiot. </p>
  
  <p>So I'm trying to retrieve the flood triggers for any given river from <a href="http://water.weather.gov" rel="nofollow noreferrer">water.weather.gov</a>. I'm using the <a href="http://water.weather.gov/ahps2/river.php?wfo=lix&amp;wfoid=18708&amp;riverid=203833&amp;pt%5B%5D=all&amp;allpoints=143846%2C142736%2C143816%2C143998%2C145144%2C142659%2C145887%2C144081%2C142375%2C143866%2C141506%2C142962%2C143885%2C153060%2C143323%2C144201%2C144542%2C142873%2C143260%2C143099%2C142560%2C144186%2C143177%2C142054%2C143945%2C144055%2C141370%2C143630%2C141931%2C142812%2C141676%2C142534%2C144568%2C143535%2C144589%2C143030%2C144031%2C143079%2C144282%2C141445%2C141722%2C141383%2C143445%2C143646%2C152882%2C143787%2C143574%2C143545%2C142773%2C141629%2C144517%2C142500%2C143196%2C142105%2C142509%2C142418%2C152996%2C152997%2C152998%2C144108%2C141463%2C152999%2C153000%2C153001%2C153002%2C152909%2C141839%2C143934%2C141618%2C146423%2C143366%2C147048%2C142172%2C151794%2C153107%2C141493%2C142940%2C144619%2C144798%2C151521%2C151430%2C144609%2C151338%2C141308%2C151468%2C144449%2C143828%2C151447%2C151342%2C142711%2C151473%2C151474%2C151475%2C151469%2C151476%2C151477%2C151448%2C151450%2C151455%2C151478%2C151451%2C151479%2C151480%2C151452&amp;data%5B%5D=xml" rel="nofollow noreferrer">Mississippi river data</a> because it has the most active measuring stations. Each station has 4 stage triggers that I am trying to obtain: <strong>Action</strong>, <strong>Flood</strong>, <strong>Moderate</strong>, and <strong>Major</strong>. I have actually been able to extract the table data for those catagories <strong>when there are numerical values</strong>, however in cases where the table data is "<strong>Not Available</strong>" the row is skipped, so that when I put the values in the correct stage they are not aligned with the appropriate station trigger. </p>
  
  <p>The table data that I'm trying to extract looks like this:</p>
  
  <pre><code>&lt;div class="box_square"&gt;        &lt;b&gt;&lt;b&gt;Flood Categories (in feet)&lt;/b&gt;&lt;br&gt;
  &lt;/b&gt;
          &lt;table width="150" cellspacing="0" cellpadding="0" border="0"&gt;
          &lt;tbody&gt;
              &lt;tr&gt;&lt;td nowrap=""&gt;Not Available&lt;/td&gt;&lt;/tr&gt;
          &lt;/tbody&gt;
  
  &lt;div class="box_square"&gt;        &lt;b&gt;&lt;b&gt;Flood Categories (in feet)&lt;/b&gt;&lt;br&gt;
  &lt;/b&gt;
          &lt;table width="150" cellspacing="0" cellpadding="0" border="0"&gt;
          &lt;tbody&gt;
              &lt;tr style="display:'';line-height:20px;background-color:#CC33FF;color:black"&gt;
                  &lt;td scope="col" nowrap=""&gt;Major Flood Stage:&lt;/td&gt;
                  &lt;td scope="col"&gt;18&lt;/td&gt;
              &lt;/tr&gt;
              &lt;tr style="display:'';line-height:20px;background-color:#FF0000;color:white"&gt;
                  &lt;td scope="col" nowrap=""&gt;Moderate Flood Stage:&lt;/td&gt;
                  &lt;td scope="col"&gt;15&lt;/td&gt;
              &lt;/tr&gt;
              &lt;tr style="display:'';line-height:20px;background-color:#FF9900;color:black"&gt;
                  &lt;td scope="col" nowrap=""&gt;Flood Stage:&lt;/td&gt;
                  &lt;td scope="col"&gt;13&lt;/td&gt;
              &lt;/tr&gt;
              &lt;tr style="display:'';line-height:20px;background-color:#FFFF00;color:black"&gt;
                  &lt;td scope="col" nowrap=""&gt;Action Stage:&lt;/td&gt;
                  &lt;td scope="col"&gt;12&lt;/td&gt;
              &lt;/tr&gt;
              &lt;tr style="display:none;line-height:20px;background-color:#906320;color:white"&gt;
                  &lt;td scope="col" nowrap=""&gt;Low Stage (in feet):&lt;/td&gt;
                  &lt;td scope="col"&gt;-9999&lt;/td&gt;
              &lt;/tr&gt;
          &lt;/tbody&gt;
          &lt;/table&gt;&lt;br&gt;&lt;/div&gt;
  </code></pre>
  
  <p>The last <strong>Low Stage</strong> isn't necessary and I have filtered it out. Here is the code that I have that will populate <code>alert_list</code> with the appropriate values, but without the necessary <strong>Not Available</strong>:</p>
  
  <pre><code>alert_list = []
  alert_values = []
  alerts = soup.findAll('td', attrs={'scope':'col'})
  for alert in alerts:
      alert_list.append(alert.text.strip()) 
  
  a_values = alert_list[1::2]
  alert_list.clear()
  major_lvl = a_values[::5]
  moderate_lvl = a_values[1::5]
  flood_lvl = a_values[2::5]
  action_lvl = a_values[3::5]
  </code></pre>
  
  <p>and the results:</p>
  
  <pre><code>&gt;&gt;&gt; major_lvl
  ['18', '26', '0', '11', '0', '17', '17', '18', '0', '683', '16', '0', '20', '16', '18', '665', '661', '18', '651', '645', '15.5', '636', '20', '631', '22', '21', '20.5', '21.5', '20', '20', '20.5', '13.5', '18', '18', '20', '18.5', '17', '14', '18', '19', '25', '25', '25', '26', '25', '24', '22', '25', '33', '34', '29', '34', '40', '40', '0', '0', '0', '42', '42', '0', '0', '0', '0', '0', '44', '47', '43', '35', '46', '52', '55', '0', '44', '57', '50', '57', '64', '40', '34', '26', '20']
  </code></pre>
  
  <p>I just noticed actually that the reason the <strong>Not Available</strong> tag isn't getting scraped is because it's under the <strong>tr</strong> tag, not <strong>td</strong>. How do I add this so that my values line up? </p>