导出到ex时打印订单列

2024-03-29 08:27:45 发布

您现在位置:Python中文网/ 问答频道 /正文

我将一些数据从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时,对于我的计算机,最左边表示顺序的列没有被考虑;而对于其他人,它是。为什么?解决办法是什么?你知道吗


Tags: 数据name示例pandas顺序servicecustomerjohn