Jun-27-2019, 01:00 PM
I have obviously never used the pandas library
Based on this answer i was astounded by the fact that pandas can just read the html with a simple single liner
Based on this answer i was astounded by the fact that pandas can just read the html with a simple single liner
df = pd.read_html(str(sov_tables)) as opposed to the OP's method:for table in sov_tables[0]:
headers = []
rows = table.find_all('tr')
for header in table.find('tr').find_all('th'):
headers.append(header.text)
for row in rows[1:]:
values = []
for col in row.find_all(['th', 'td']):
values.append(col.text)
if values:
cntr_dict = {headers[i]: values[i] for i in range(len(values))}
cntr.append(cntr_dict)It appears pandas read_html method is only for tables. Is there any other tricks pandas has to someone that is not familiar with it?
Recommended Tutorials:

![[Image: ObBD1s.jpg]](https://imagizer.imageshack.com/v2/xq90/921/ObBD1s.jpg)
![[Image: Fablzi.jpg]](https://imagizer.imageshack.com/v2/xq90/923/Fablzi.jpg)
![[Image: 1p48av.jpg]](https://imagizer.imageshack.com/v2/xq90/922/1p48av.jpg)
![[Image: TAlg6M.jpg]](https://imagizer.imageshack.com/v2/xq90/921/TAlg6M.jpg)
![[Image: emFbyk.jpg]](https://imagizer.imageshack.com/v2/xq90/922/emFbyk.jpg)
![[Image: hL6MsW.jpg]](https://imagizer.imageshack.com/v2/640x480q90/923/hL6MsW.jpg)