언어/Python
[ Pandas ] columns 가 multi header 일때
쟈누
2021. 7. 19. 11:27
반응형
1. 개요
에러는 아니지만 멀티 컬럼을 다루는 법을 이번에 알게되어 기록하고자 한다.
아래와 같다
그리고 이 header 를 컬럼만 따로 뽑아서 나타낼 경우에는 아래와 같이 나타난다.
이 중에서 하나만 뽑아서 사용하고 싶다
2. 추출하는 법
추출하는 법은 생각보다는 간단했다.
read_csv, read_table 에 있는 header 에 리스트로 추출하고자 하는 컬럼의 인덱스 번호를 사용하면 된다.
그러면 아래 컬럼의 header 와 같이 나온다.
3. 참고 링크
https://stackoverflow.com/questions/41005577/python-pandas-two-rows-as-column-headers/51746183
Python Pandas, two rows as column headers?
I have seen how to work with a double index, but I have not seen how to work with a two-row column headers. Is this possible? For example, row 1 is a repetitive series of dates: 2016, 2016, 2015,...
stackoverflow.com
반응형