Sum of the column of the CSV file
1
0
Entering edit mode
7 weeks ago
harry ▴ 30

I have a CSV file like below and I want to sum the columns 2 and column 3 and write the total at the end of the column as below:

Here is my file:

read,match,not_match
human_file_0000003,5,2
human_file_0000004,6,0
human_file_0000005,6,9
human_file_0000006,4,0
human_file_0000007,2,0
human_file_0000008,5,0
human_file_0000009,3,0


And I want to output my file like below:

read,match,not_match
human_file_0000003,5,2
human_file_0000004,6,0
human_file_0000005,6,9
human_file_0000006,4,0
human_file_0000007,2,0
human_file_0000008,5,0
human_file_0000009,3,0
31,11


In which you can see column 2 total is 31 and column 3 total is 11. Thanks in advance for your suggestion. I search for it but I can't find any solution for that.

CSV sum • 257 views
0
Entering edit mode
0
Entering edit mode

In that, they add column 2 and column 3. Here I want to separate the sum of the total in column 2 and the separate sum of the total in column 3.

2
Entering edit mode
7 weeks ago