IT
[python]Pandas에서 열 이름의 이름을 바꾸는 것
Pandas에서 열 이름의 이름을 바꾸는 것 질문 Pandas 데이터 프레임의 열 레이블을 어떻게 변경합니까?['$a', '$b', '$c', '$d', '$e'] 에게['a', 'b', 'c', 'd', 'e']. 답변 특정 열의 이름을 바꿉니다df.rename () 함수를 사용하고 이름을 바꿀 열을 참조하십시오.모든 열의 이름을 바꿀 필요가 없습니다.df = df.rename(columns={'oldName1': 'newName1', 'oldName2': 'newName2'}) # Or rename the existing DataFrame (rather than creating a copy) df.rename(columns={'oldName1': 'newName1', 'oldName2': 'newNa..
2022. 4. 14. 12:17
최근댓글