Python 使用pytrends获取冠状病毒数据
以上是我的代码。我不知道如何设置输出?此外,我还希望输出的数据更加丰富,比如显示关键字的趋势Python 使用pytrends获取冠状病毒数据,python,web-scraping,Python,Web Scraping,以上是我的代码。我不知道如何设置输出?此外,我还希望输出的数据更加丰富,比如显示关键字的趋势 谢谢你的帮助 你的语法全错了。尝试: kw = ['Coronavirus'] import pandas as pd from pytrends.request import TrendReq pytrends = TrendReq(hl='en us',tz=360) kw = ['Coronavirus'] search_df = pytrends.get_historical_interes
谢谢你的帮助 你的语法全错了。尝试:
kw = ['Coronavirus']
import pandas as pd
from pytrends.request import TrendReq
pytrends = TrendReq(hl='en us',tz=360)
kw = ['Coronavirus']
search_df = pytrends.get_historical_interest(kw)
search_df
主要来自
from pytrends.request import TrendReq
pytrend = TrendReq(hl='en-US', tz=360, retries=10, backoff_factor=0.5)
search_df = pytrend.get_historical_interest(
keywords=['Coronavirus'],
year_start=2020,
year_end=2020,
month_end=4,
month_start=2
)
print(search_df)
pytrend.build_payload(kw_list=['Coronavirus'])
# Interest Over Time
interest_over_time_df = pytrend.interest_over_time()
print(interest_over_time_df.tail())
# Interest by Region
interest_by_region_df = pytrend.interest_by_region()
print(interest_by_region_df.head())