해피 코딩
크롤링2
Broca & Wernicke
2019. 8. 17. 17:40
크롤링을 하다보면 (scrape이 더 맞는 표현이더군) 텍스트 출력(csv 포함)만으로 부족한 경우가 있다.
긴 문장이 하나의 필드로 들어가야 하는 경우가 종종 있어서 엑셀로 저장하는 것이 훨씬 유리하다.
아니, csv로 받아서는 아예 답이 안나온다.
엑셀로 저장하기 위해 panda library를 사용한다.
기본 사용법은 우선 여기를 참조(https://korbillgates.tistory.com/148)
여려 페이지의 데이터를 스크래이핑 할 때는 페이지마다 저장을 하는게 좋다.
안그랬다간 시간만 잡아 먹고 남은게 하나도 없게 되는 일이...
중간중간 저장을 위해서는 다음과 같은 방법이 필요하다.
https://stackoverflow.com/questions/47737220/append-dataframe-to-excel-with-pandas/47738103
append dataframe to excel with pandas
I desire to append dataframe to excel This code works nearly as desire. Though it does not append each time. I run it and it puts data-frame in excel. But each time I run it it does not append....
stackoverflow.com