electiondata icon indicating copy to clipboard operation
electiondata copied to clipboard

Add file type 'html'

Open sfsinger19103 opened this issue 5 years ago • 1 comments

import pandas as pd
url = “https://www.votecnmi.gov.mp/election-2020”
df_list = pd.read_html(url, match=“CANDIDATE”)

This code gives a list of data frames, one for each table in the html that has the word "CANDIDATE" in it. More generally, can use a regex to identify tables.

So can add a file_type=html option, with the usual other parameters.

sfsinger19103 avatar Apr 23 '21 04:04 sfsinger19103

Instead of pulling the html directly from the web server into pandas data frames, pull html into a file, documented in the usual way, and then process.

sfsinger19103 avatar Apr 23 '21 04:04 sfsinger19103