인프런 영문 브랜드 로고
인프런 영문 브랜드 로고

Inflearn Community Q&A

hhyaluu4789's profile image
hhyaluu4789

asked

Getting started with data analysis with Kaggle surveys

[4/13] 🌏 Where does Kaggler live and what does he do?! - Reducing repetitive tasks with functions (1)

리스트 에러

Written on

·

196

1

q1_cols = answer['Q1'].value_counts().sort_index().index.tolist()

여기서 에러 때문에 tolist()를 쓰셨다고 하셨는데 

그럼 함수 안에 있는   if not order: 

        order = answer[qno].value_counts().index

이 부분은 왜 리스트로 안 바꿔줘도 에러가 안 나는건가요?

pandaskaggleseaborn

Answer 1

1

todaycode님의 프로필 이미지
todaycode
Instructor

안녕하세요.

판다스의 시리즈를 지원여부에 따라 작성하게 됩니다.

또 판다스 라이브러리는 업데이트가 꾸준히 되는 편이라 버전에 따라 차이가 있기도 합니다.

시리즈 데이터 타입을 지원하면 시리즈로, 지원하지 않는다면 리스트로 변경해서 넣어주면 됩니다.

 

hhyaluu4789's profile image
hhyaluu4789

asked

Ask a question