from importData import *


ggr=ggrImport()
vendor=vendorImport()
def diffUser(ggr=ggr,vendor=vendor):
    ggr_sum=ggr[['username','FAMOUNT']]
    ggr_sum=ggr_sum.groupby(['username']).sum().reset_index()

    vendor_sum=vendor[['Player ID','Player WinLoss']]
    vendor_sum=vendor_sum.groupby('Player ID').sum().reset_index()
    #print(ggr_sum.head())
    #print(vendor_sum.head())

    compareNames=pd.merge(ggr_sum,vendor_sum,left_on='username',right_on='Player ID',how='outer').fillna(0)
    compareNames['ggr']=round(compareNames['FAMOUNT'])
    compareNames['WinLoss']=round(compareNames['Player WinLoss'])
    compareNames=compareNames.drop(['Player ID','Player WinLoss','FAMOUNT'],axis=1)
    #print(compareNames.head())
    name_list=[]
    for n in range(len(compareNames)):
        if compareNames.iloc[n,1]!=compareNames.iloc[n,2]:
            name_list.append(compareNames.values[n,0])

    compareNames=compareNames[compareNames['username'].isin(name_list)]
    #compareNames.to_csv('compareName.csv')
    print('Export done.')
    return name_list



