[Python] 구글 트렌드(Google Trends PYTHON API)
Google Trend 에 연결하기
pip 를 이용해 pytrends library 를 받는다.
pip install pytrends |
Google Trend Python 을 import 하여 사용
TrendReq 의 매개변수
- host language(hl) = "ko"
- Timezone(tz) = 360
pytrends.build_payload 의 매개변수
- keyword: 데이터를 가져올 키워드 목록(한번에 5개 키워드로 제한)
- geo: 지리적 위치
- timeframe: 관심있는 시간 프레임
keywords=["코로나"]
pytrends = TrendReq(hl="ko", tz=360)
pytrends.build_payload(keywords, cat=0, timeframe="today 5-y", geo="KR", gprop="")
getdatainfo = pytrends.interest_over_time()
print(getdatainfo)
getdatainfo.to_csv(csvPath, encoding="utf-8")
'IT > 컴퓨터프로그램' 카테고리의 다른 글
[Python] FinanceDataReader 를 통한 주가 읽기 - 이동 평균선 (1) | 2022.05.16 |
---|---|
[Python] FinanceDataReader 를 통한 주가 읽기 (0) | 2022.05.16 |
[프로그램] 임베디드 시스템 (Embedded System) (1) | 2022.05.16 |
[PYTHON] 숫자(초)을 시간으로 바꾸기 (0) | 2022.05.16 |
[PYTHON] 최상위 스크립트 환경 (0) | 2022.05.16 |