지방이의 Data Science Lab

[Python] 컬럼명 하나만 위치를 재배치하고 싶은 경우 본문

Data Analysis/Python

[Python] 컬럼명 하나만 위치를 재배치하고 싶은 경우

[지현] 2021. 2. 9. 18:36

컬럼의 위치를 변경하자

1
2
3
4
col1 = genres.columns[-1:].to_list()
col2 = genres.columns[:-1].to_list()
new_col = col1+col2
genres = genres[new_col]

 

Comments