我有一个输出的 Dataframe 下面,到一个字典。
{0: ['RevitCategory', 'Door'],
1: ['DesignModelID', 'ModelA_Rev1'],
2: ['DesignObjectID', 'ModelA_Rev1_Object1'],
3: ['TypeName', 'ARC_DOR_INTERNAL'],
4: ['Function', 'Internal'],
5: ['Uniclass2015_Ss', 'Ss_25_30_20_25 : Doorset systems'],
6: ['IfcExportAs', 'IfcDoorType.DOOR'],
7: ['NRM1Classification', '2.8.1.1 Internal doors'],
8: ['RevitCategory', 'Wall'],
9: ['DesignModelID', 'ModelA_Rev1'],
10: ['DesignObjectID', 'ModelA_Rev1_Object2'],
11: ['TypeName', 'ARC_WALL_PARTITION_TYPE1'],
12: ['Function', 'Internal'],
13: ['Uniclass2015_Ss', 'Ss_25_10_30_35 : Gypsum board partition systems'],
14: ['IfcExportAs', 'IfcWallType.PARTITIONING'],
15: ['NRM1Classification', '2.7.1.1 Internal walls'],
16: ['Area', 5],
17: ['RevitCategory', 'Wall'],
18: ['DesignModelID', 'ModelA_Rev1'],
19: ['DesignObjectID', 'ModelA_Rev1_Object3'],
20: ['TypeName', 'ARC_WALL_PARTITION_TYPE1'],
21: ['Function', 'Internal'],
22: ['Uniclass2015_Ss', 'Ss_25_10_30_35 : Gypsum board partition systems'],
23: ['IfcExportAs', 'IfcWallType.PARTITIONING'],
24: ['NRM1Classification', '2.7.1.1 Internal walls'],
25: ['Area', 5],
26: ['RevitCategory', 'Wall'],
27: ['DesignModelID', 'ModelA_Rev1'],
28: ['DesignObjectID', 'ModelA_Rev1_Object4'],
29: ['TypeName', 'ARC_WALL_PARTITION_TYPE1'],
30: ['Function', 'Internal'],
31: ['Uniclass2015_Ss', 'Ss_25_10_30_35 : Gypsum board partition systems'],
32: ['IfcExportAs', 'IfcWallType.PARTITIONING'],
33: ['NRM1Classification', '2.7.1.1 Internal walls'],
34: ['Area', 5]
如何合并列,例如在类似下面的输出中,在合并列时堆叠列的结果?
RevitCategory | DesignModelID | DesignObjectID | etc.
-----------------------------------------------------------------
Door | ModelA_Rev1 | ModelA_Rev1_Object1 |
Wall | ModelA_Rev1 | ModelA_Rev1_Object1 |
Wall | ModelA_Rev1 | ModelA_Rev1_Object1 |
-----------------------------------------------------------------
2条答案
按热度按时间9rygscc11#
您可以使用
DataFrame.from_records
创建记录和 Dataframeocebsuys2#
除非我误解了你的问题,并取决于
'RevitCategory'
是否标志着新行的开始,它可以像这样工作。我不知道是否有一个解决方案更习惯于Pandas。