title: Python - Figuring out the Xpaths of attribute data-* in HTML
body: <p>Trying to figure out how to extract the data from this webpage and place it into a .csv. file: <a href="https://www.basketball-reference.com/draft/BAA_1947.html" rel="nofollow noreferrer">https://www.basketball-reference.com/draft/BAA_1947.html</a></p>
  
  <p>The table structure for each row looks something like the following picture below:</p>
  
  <pre><code>&lt;tr data-row="12"&gt;
      &lt;th scope="row" class="right " data-stat="ranker" &gt;11&lt;/th&gt;
          &lt;td class="left " data-stat="player" csk="Bolyard,Robert" &gt;Robert Bolyard&lt;/td&gt;
          &lt;td class="left " data-stat="college_name" csk="University of Toledo" &gt;&lt;a href="/friv/draft.fcgi?college=toledo"&gt;University of Toledo&lt;/a&gt;&lt;/td&gt;
          &lt;td class="right " data-stat="seasons" &gt;12&lt;/td&gt;
  &lt;/tr&gt;
  </code></pre>
  
  <p>I want to know the Xpath values to grab the text.</p>
  
  <p>So far I have the following:</p>
  
  <pre><code># Xpath
  player = data.xpath("//td/span[@data-stat='player']/text()") 
  college = data.xpath("//td/span[@data-stat='college_name']/a/text()") 
  seasons = data.xpath("//td/span[@data-stat='seasons']/text()")
  </code></pre>
  
  <p>Issue is it doesn't return any values into any column. What might be wrong with the Xpath statements?</p>