首页 > 解决方案 > 本网站(nseindia.com)的动态数据未导入 python pandas

问题描述

网站链接:https ://www.nseindia.com/products/content/equities/equities/eq_security.htm

import requests
import pandas as pd

headers = {
    "User-Agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:71.0) Gecko/20100101 Firefox/71.0",
    "Accept": "*/*",
    "Accept-Language": "en-US,en;q=0.5",
    "X-Requested-With": "XMLHttpRequest"
}
r = requests.get('https://www.nseindia.com/products/dynaContent/common/productsSymbolMapping.jsp?symbol=TCS&segmentLink=3&symbolCount=2&series=ALL&dateRange=+&fromDate=13-12-2019&toDate=18-12-2019&dataType=PRICEVOLUMEDELIVERABLE', headers=headers)

df = pd.read_html(r.text)

print(df)

我已经尝试过编写代码,但它给了我这个错误ValueError: No tables found

标签: python-3.xpandasweb-scraping

解决方案


推荐阅读