Looking for a more efficient way to reorganize a massive CSV in Python

后端 未结 2 726
刺人心
刺人心 2021-01-20 16:20

I\'ve been working on a problem where I have data from a large output .txt file, and now have to parse and reorganize certain values in the the form of a .csv.

I\'ve

2条回答
  •  孤独总比滥情好
    2021-01-20 17:00

    You can try the UNIX sort utility:

    sort -n -s -t, -k1,1 infile.csv > outfile.csv
    

    -t sets the delimiter and -k sets the sort key. -s stabilizes the sort, and -n uses numeric comparison.

提交回复
热议问题