【发布时间】:2021-05-31 10:33:25
【问题描述】:
我对 Pytrends,特别是 TZ 有点吃力。更改时区时,不会更改输出中的时间戳。
pytrends = TrendReq(hl = 'en-US', tz = 120)
keywords = ['lei', 'lei code', 'legal entity identifier']
data = pytrends.get_historical_interest(keywords, year_start=2021, month_start=5, day_start=30,
hour_start=0, year_end=2021, month_end=6, day_end=1,
hour_end=0, geo='IE', gprop='', sleep=0)
data
输出:
date lei lei code legal entity identifier isPartial
2021-05-31 07:00:00 54 0 0 False
2021-05-31 08:00:00 44 13 0 False
2021-05-31 09:00:00 33 0 0 False
2021-05-31 10:00:00 74 0 0 True
如果我再更改时区 (tz),则输出相同
pytrends = TrendReq(hl = 'en-US', tz = 0)
keywords = ['lei', 'lei code', 'legal entity identifier']
data = pytrends.get_historical_interest(keywords, year_start=2021, month_start=5, day_start=30,
hour_start=0, year_end=2021, month_end=6, day_end=1,
hour_end=0, geo='IE', gprop='', sleep=0)
data
输出:
date lei lei code legal entity identifier isPartial
2021-05-31 07:00:00 54 0 0 False
2021-05-31 08:00:00 44 13 0 False
2021-05-31 09:00:00 33 0 0 False
2021-05-31 10:00:00 74 0 0 True
可能我错过了一些明显的东西,但是我怎样才能使时间随着时区而改变。 正在考虑只是滞后输出。
关于K
【问题讨论】:
标签: python timezone google-trends