Excel 表格单列相同项目汇总

解决的需求:
同列 Excel 表格中,将相同日期的项目金额进行汇总相加。

# 将日期相同的部分进行求和,打印出求和项数目
import ubpa.iexcel as iexcel

def add_num():
    data = []
    line_ae = iexcel.read_col(path='file path and parameters')
    line_ag = iexcel.read_col(path='file path and parameters')    
    for x in range(len(line_ag)):
        data.append([int(line_ae[x]), int(line_ag[x])])
    # calculate sum 
    aim = list(set(line_ag))  # delete the same items
    print(data)
    print(aim)
    for x in aim:
        a = 0
        for y in data:
            if int(x) == y[1]:
                a += y[0]
        print(a)