我将一些数据从Python/pandas导出到Excel,其中包含一个表示顺序的列。示例:
+----+---------+------------------+------+------+---------+
| | Name | Task | Team | Date | Month |
+----+---------+------------------+------+------+---------+
| 0 | John | Market study | A | 1 | Month 1 |
+----+---------+------------------+------+------+---------+
| 1 | Michael | Customer service | B | 1 | Month 1 |
+----+---------+------------------+------+------+---------+
| 2 | Joanna | Accounting | C | 1 | Month 1 |
+----+---------+------------------+------+------+---------+
| 3 | John | Accounting | B | 2 | Month 1 |
+----+---------+------------------+------+------+---------+
| 4 | Michael | Customer service | A | 2 | Month 1 |
+----+---------+------------------+------+------+---------+
| 5 | Joanna | Market study | C | 2 | Month 1 |
+----+---------+------------------+------+------+---------+
| 6 | John | Market study | A | 1 | Month 3 |
+----+---------+------------------+------+------+---------+
| 7 | Michael | Customer service | B | 1 | Month 3 |
+----+---------+------------------+------+------+---------+
| 8 | Joanna | Accounting | C | 1 | Month 3 |
+----+---------+------------------+------+------+---------+
| 9 | John | Customer service | A | 2 | Month 3 |
+----+---------+------------------+------+------+---------+
| 10 | Michael | Accounting | B | 2 | Month 3 |
+----+---------+------------------+------+------+---------+
问题是,当我将文件重新导入pandas时,对于我的计算机,最左边表示顺序的列没有被考虑;而对于其他人,它是。为什么?解决办法是什么?你知道吗
使用
df.to_excel(file.xlsx, index=False)
保存到文件.xlsx没有索引相关问题 更多 >
编程相关推荐