我有一个CSV文件, struct 如下:
time,magnitude
0,13517
292.5669,370
620.8469,528
0,377
832.3269,50187
5633.9419,3088
20795.0950,2922
21395.6879,2498
21768.2139,647
21881.2049,194
0,3566
292.5669,370
504.1510,712
1639.4800,287
46709.1749,365
46803.4400,500
我想将此CSV文件拆分为单独的CSV文件,如下所示:
文件1:文件1:
time,magnitude
0,13517
292.5669,370
620.8469,528
文件2:文件2:
time,magnitude
0,377
832.3269,50187
5633.9419,3088
20795.0950,2922
21395.6879,2498
以此类推..
我读过几篇类似的文章(例如,this、this或this one),但它们都在一列中搜索特定值,并将每组值保存到一个单独的文件中.但是,在我的例子中,Time列的值并不相同.我想分开,条件是:If time = 0, save that row and all subsequent rows in a new file until the next time =0
.
有没有人能告诉我怎么做?