[TIP / Pandas] Change Columns Order (열 순서 바꾸기)
열 순서 바꾸기def change_column_order(data , cols:list , positions:list) : for position , col in zip(positions , cols) : pop_ = data.pop(col) data.insert(position, pop_.name, pop_.values) return data data = change_column_order(data , cols =["key"], positions=[0])
2020.10.28