如何獲取數據框集的索引作爲列,反之亦然?我試圖摧毀它,但徒勞無功。將數據幀的索引設置爲列,反之亦然
我希望把這個數據幀
Type1 Type2 Type3
Hour
0 5 0 13
1 3 5 5
2 3 2 11
3 9 3 8
4 1 3 2
5 0 0 2
6 1 5 0
7 0 1 0
8 2 0 0
9 1 0 1
10 0 0 2
11 6 2 2
12 5 3 1
13 3 4 2
14 4 2 4
15 10 3 6
16 7 1 6
17 18 1 5
18 6 2 6
19 2 4 27
20 10 8 16
21 19 12 36
22 5 9 11
23 8 8 23
以下;
0 1 2 3 4 5 6 7 8 9 10 ...
Type 1 5 3 3 9 1 ....
Type 2 0 5 2 3 3 ....
Type 3 13 5 11 8 2 ....
編輯: 其實,我在原來的DF看起來像[(0, 1), (1, 1), (2, 1), (3, 1), (4, 1), (5, 1), (6, 1), (7, 1), (8, 1), (9, 1), (10, 1), (11, 1), (12, 1), (13, 1), (14, 1), (15, 1), (16, 1), (17, 1), (18, 1), (19, 1), (20, 1), (21, 1), (22, 1), (23, 1)]
多指數。我該如何處理?
是的這更簡單 – EdChum
謝謝!那很酷 – richie