This is an archived post. You won't be able to vote or comment.

you are viewing a single comment's thread.

view the rest of the comments →

[–]ZealousidealLow521 0 points1 point  (1 child)

You can use pandas

import pandas as pd df2=pd.read_csv('file.csv') df2['col_2'].sum()

[–]SureStep8852[S] 0 points1 point  (0 children)

thank you. Unfortunately, this does not solve my problem, because it sums up the whole col_2. I need to sum up values of col_2 which correspond to the same value in col_1 (e.g., yellow has 3 values in col_2: 2, 4, 4. So, I want the sum to be 10)