我无法提供要在csv文件中返回的列列表。
trans.to_csv('study10.csv' , encoding='utf-8', columns = [("reg_no", "st_name", "c_six_to_ten", "values")] )
KeyError: "[[('reg_no', 'st_name', 'c_six_to_ten', 'values')]] are not in ALL in the [columns]"
如何选择要保存到csv文件的列?
答案 0 :(得分:1)
应该是:
trans.to_csv('study10.csv' , encoding='utf-8', columns = ["reg_no", "st_name", "c_six_to_ten", "values"] )
你尝试的是一个包含单个元组的列表