강의

멘토링

커뮤니티

Inflearn Community Q&A

trulife72's profile image
trulife72

asked

Finding Signals and Noise through Python Stock Data Collection and Analysis

[5/6] Viewing the entire data collection process with tqdm, merging data with merge, and saving data with to_csv

5/6 tqdm으로 전체 데이터...

Written on

·

1.1K

0

concat으로 전제 종목을 합치는 pd.concat(result.tolist()) 코드 실행시 오류가 납니다. 오류 메세지는 : InvalidIndexError: Reindexing only valid with uniquely valued Index objects

입니다.

get_item_info 함수를 실행해서 result 결과를 확인해 보니, index 가 모두 같지 않은 것 같습니다. 오류 부분이 어디일까요?

pythonpandasnumpy웹-크롤링seabornplotlymatplotlib웹-스크래핑

Answer 2

0

trulife72님의 프로필 이미지
trulife72
Questioner

업종 중 제약에 있는 종목만 하는 경우에 에러가 납니다.

#url = 'https://finance.naver.com/sise/sise_group_detail.naver?type=upjong&no=261'

제약 업종에 포함된 '에이아이더뉴트리진'의 종목 화면에 보면 투자정보란에 공란이 있어서 발생하는 에러는 아닐까요?

0

todaycode님의 프로필 이미지
todaycode
Instructor

안녕하세요. 판다스 최근 버전에서 해당 문제가 발생하곤 합니다.

다음 코드에서 ignore_index=True 를 추가해 보세요!

df_item = pd.concat(item_info, ignore_index=True)

저도 같은 문제인데 get_item_info 함수 내에
ignore_index=True를 추가하여도 같은 오류가 발생하는데 어떻게 해결해야 될까요./.

trulife72's profile image
trulife72

asked

Ask a question