-1
I have a spreadsheet in excel format (.xlsx) with the following columns: "matricula", "name", "value", as shown below.
I would like to delete the repeated data by adding up the values.
The final result should be another spreadsheet in excel with only 6 (six) lines, equal to the second image below.
Below would be the spreadsheet with the desired result.
import pandas as pd
planilha = pd.read_excel(r"C:\Users\wjrs1\Downloads\nova.xlsx", engine='openpyxl')
arquivo = pd.ExcelWriter(r"C:\Users\wjrs1\Downloads\teste.xlsx")
arquivo.to_excel(planilha, 'sheet1',index=False) #tem algo dando errado e não sei o que é
planilha.save()
Could you help me? Thank you in advance.
groupby(['Registration', 'Name', 'Value'], as_index=False)['Value']. sum()
– Alexandre Simões
Use
DataFrame.drop_duplicates()
. Example:planilha.drop_duplicates()
– Augusto Vasques