ive been trying to scrape data from 2015-2020,but it always show error [WinError 10054] An existing connection was forcibly closed by the remote host,do you know what problem is?
import pandas as pd
import requests
url = 'https://www.bi.go.id/id/moneter/informasi-kurs/transaksi-bi/Default.aspx'
header = {'user-agent': 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10.9; rv:32.0) Gecko/20100101 Firefox/32.0',}
r = requests.get(url, headers=headers)
df = pd.read_html(
"https://www.bi.go.id/id/moneter/informasi-kurs/transaksi-bi/Default.aspx", header=0)[-4]
df['Tanggal'] = pd.to_datetime(df["Tanggal"])
df = df.iloc[::-1].reset_index(drop=True)
df.columns = ['nilai', 'kurs_jual', 'kurs_beli', 'tanggal']