Python:将CVS非表格数据转换为表格格式

时间:2019-06-20 15:10:28

标签: python python-2.7

我有一个看起来像这样的CSV。

2019    Team    M2  Location    6c
    Total Cost  11725.12610 - 7859.54000        
    Average Cost    9.24 - 11.18000     
2019    Team    M2  Location    6e
    Total Cost  210 - 211.00000     
    Average Cost    15.00 - 33.24922        
2019    Team    7W  Location    6c
    Total Cost  11725.12610 - 7859.54000        
2019    Team    X8  Location    6c
    Total Cost  1336.00 - 1095.08       
2019    Team    G0  Location    6c
    Total Cost  5831.00 - 4366.55       
2019    Team    6I  Location    6c
    Total Cost  3150.00000 - 7015.58610     
    Average Cost    1857.00 - 948.13        
2019    Team    6R  Location    6c
    Total Cost  7284.75 - 7089.89       

我想操纵数据以将其转换为具有以下标题的列:

Year; Team; Location; Total Cost (Low); Total Cost (High);Average Cost (Low);   Average Cost (High)

该列中的相同数据将是

2019;   M2; 6c; 11725.12;   7859.54;    9.24;   11.18

2019;   M2; 6e; 210;            211;            15; 33.24922

2019;   7W; 6c; 11725.12;   7859.54;    0;  0

2019;   X8; 6c; 1336;       1095.08;    0;  0

2019;   G0; 6c; 5831;           4366.55;    0;  0

2019;   6I; 6c; 3150;           7015.58;    1857;   948.13

2019;   6R; 6c; 7284.75;    7089.89;    0;  0

我们一直在excel中转​​换这些文件,这非常耗时。

0 个答案:

没有答案