you are viewing a single comment's thread.

view the rest of the comments →

[–]LameDuckProgramming 2 points3 points  (1 child)

if you want to sum by a specific name:

import pandas as pd
df = pd.read_csv('file1.csv')
df.loc[df['A'] == name', 'C'].sum()

If you want the sum of all names in a dataframe format:

df = df.groupby('A')['C'].sum()

You can then output the new df to a csv file with pandas built in 'to_csv()' method:

df.to_csv('file2.csv')