Getting Column Headers¶

First lets grab the information that will become the column headers of our DataFrame . That information is found in the content of a table header cell HTML element (which are denoted by the tags), which is found within a table row element ( ) of a table header element ( ) of a table element ( ).

The HTML structure would look something like this:

The text we want is between these HTML tags

As an example, lets take a look at the table header cell element for the 'Player' column header:

Player

We want to extract the text content (which would be 'Player' in above example) from all elements like one above and store them into a list.

By inspecting the HTML document (in Chrome you do this by right-clinking on the webpage and selecting "Inspect element" from the dropdown menu) we see that the 2nd table row is the one that contains the table headers we want.

Using BeautifulSoup to get this information is pretty straightfoward. All we have to do is: