Web Scraping Exercise: DataFrames to CSV
Perform web scraping on a Wikipedia page to extract the DataFrames, and export them as CSV files for analysis.
We'll cover the following
We've already read and parsed a Wikipedia web page containing tables ranking the world’s largest banks by total assets and by country. We'll leverage this parsed data to create pandas DataFrames and export them as CSV files for further analysis.
Let’s convert the parsed HTML tables into pandas DataFrames and export them as CSV files.
Create DataFrames using pandas
After collecting the wikitables from Wikipedia, import pandas
and use the pd.read_html()
method to convert these HTML tables into a list of DataFrame objects.
Get hands-on with 1200+ tech skills courses.