DanHammond94
DanHammond94

Reputation: 47

Scraping data from ESPNCricInfo StatsGuru in a .csv using Python

Please could you advise on how to scrape from the following URL:

https://stats.espncricinfo.com/ci/engine/stats/index.html?class=1;filter=advanced;orderby=innings;size=200;spanmax1=07+Aug+2020;spanmin1=07+Aug+2015;spanval1=span;template=results;type=batting

... so that the result can sit in a table like this:

enter image description here

The issue I'm having is multiple HTML tags with the same class 'engineTable'.

Thank you!

Upvotes: 1

Views: 2045

Answers (1)

dimay
dimay

Reputation: 2804

Try it:

import pandas as pd

df = pd.read_html("https://stats.espncricinfo.com/ci/engine/stats/index.html?class=1;filter=advanced;orderby=innings;size=200;spanmax1=07+Aug+2020;spanmin1=07+Aug+2015;spanval1=span;template=results;type=batting")[2]

Upvotes: 2

Related Questions