I\'m trying to scrape the data from the coins catalog.
There is one of the pages. I need to scrape this data into Dataframe
So far I have this code:
<
Try:
import pandas as pd
from bs4 import BeautifulSoup
soup = BeautifulSoup(html, "html.parser")
table = soup.find('table', attrs={'class':'subs noBorders evenRows'})
table_rows = table.find_all('tr')
res = []
for tr in table_rows:
td = tr.find_all('td')
row = [tr.text.strip() for tr in td if tr.text.strip()]
if row:
res.append(row)
df = pd.DataFrame(res, columns=["Year", "Mintage", "Quality", "Price"])
print(df)
Output:
Year Mintage Quality Price
0 1882 108,000 UNC —
1 1883 786,000 UNC ~ $4.03