Why does the pandas the dataframe column order change automatically?

后端 未结 2 1667
傲寒
傲寒 2021-01-27 10:11

When I were output the result to CSV file, I generated a pandas dataframe. But the dataframe column order changed automatically, I am curious Why would this happened?

2条回答
  •  南笙
    南笙 (楼主)
    2021-01-27 11:06

    I notice you use a dictionary.

    Dictionaries in python are not garanteed to be in any order. It depends on multiple factors, including what's in the array. Keys are garanteed to be unique though

提交回复
热议问题