How would I take a df like this:
Dates Type 1 2 3 ...
2018-01-01 Type1 Golf Van Jeep
2018-01-02 Type1 Golf Van Jeep
2018-01-01 Type2 Golf1 Van1 Jeep1
2018-01-02 Type2 Golf2 Van2 Jeep2
并将其转化为:
Type1 Type2
Dates 1 2 3 1 2 3 ...
2018-01-01 Golf Van Jeep Golf1 Van1 Jeep1
2018-01-02 Golf Van Jeep Golf2 Van2 Jeep2
编辑: 我想要引入第二个类似于这样的索引:
Type Type1 Type2
Numbers 1 2 3 1 2 3
Dates ...
2018-01-01 Golf Van Jeep Golf1 Van1 Jeep1
2018-01-02 Golf Van Jeep Golf2 Van2 Jeep2
编辑: 现在,如果我想重新标记所有数字索引值 - 我该如何创建它:
Type Type1 Type2
Numbers p1 p2 p3 p1 p2 p3
Dates ...
2018-01-01 Golf Van Jeep Golf1 Van1 Jeep1
2018-01-02 Golf Van Jeep Golf2 Van2 Jeep2
编辑:
可以直接使用:
.add_prefix('hh')
.add_prefix('pp')
。 - Bob