티스토리 뷰
예시 : 네이버 뉴스 수집 자료
* 최근 1개월간의 뉴스 제목에 포함된 단어들 중에서 최근 1주일 사이에만 등장하는 단어들 목록을 출력하는 프로그램
def LoadItems_NaverNews():
gs1 = cBGoogleSpread()
spreadName = "NaverNews"
date0 = datetime.now()
date1 = date0 - timedelta(weeks=1) # 1 week ago
date2 = date1 - relativedelta(months=1) # 1 month ago
try:
ss1 = gs1.OpenSpreadsheet(spreadName)
except Exception as e:
print("{???]", str(e))
return DataFrame()
sheetName = "Overview"
itemList_DF = gs1.ReadSheet(ss1, sheetName)
itemInfoList = itemList_DF.to_dict('records')
newNounsString = "Latest Nouns compared to a last month\n\n"
textKey = "Title"
dateKey = "I.Date"
for itemInfo1 in itemInfoList:
# print(itemInfo1)
keyWord1 = itemInfo1['Keyword']
itemData_DF=LoadData_NaverNews(itemInfo1)
newNouns = ExtractNewNounCount(itemData_DF, textKey, dateKey) # Dict
if not newNouns: continue
newNounsString += "["+keyWord1+"]\n"
for noun1 in newNouns.keys():
newNounsString += noun1 +", "
newNounsString += "\n\n"
#WordCloud01(titleString2)
print("[NewNounsString]", newNounsString)
print("[End] LoadItems_NaverShopping()")
return itemData_DF

반응형
'SWDesk' 카테고리의 다른 글
[Python] 1분 단위 데이터 파헤치기 (0) | 2021.09.18 |
---|---|
[Python] 1분 데이터 가져오기 (0) | 2021.09.11 |
[Python] datetime 예제 (0) | 2021.08.24 |
[Python] 수집된 자료를 정리하는 파이썬 소스 코드 (0) | 2021.08.22 |
[Python] Archiving in ZIP (0) | 2021.08.14 |
반응형
250x250
최근에 올라온 글
최근에 달린 댓글
- Total
- Today
- Yesterday
링크
TAG
- DYOV
- image
- 심심풀이
- Innovation&Hurdles
- 티스토리챌린지
- Hurdles
- 치매방지
- 전류
- BSC
- arduino
- 둎
- 오블완
- bilient
- 혁신과허들
- Video
- 아두이노
- 전압
- ServantClock
- 허들
- 전압전류모니터링
- Innovations
- 심심풀이치매방지기
- Decorator
- 빌리언트
- 혁신
- badp
- 배프
- 절연형
- 치매
- Innovations&Hurdles
일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
1 | 2 | 3 | 4 | 5 | ||
6 | 7 | 8 | 9 | 10 | 11 | 12 |
13 | 14 | 15 | 16 | 17 | 18 | 19 |
20 | 21 | 22 | 23 | 24 | 25 | 26 |
27 | 28 | 29 | 30 |
글 보관함