print(my_df.columns)
dfvendedor = my_df.groupby('seller_name').sum().sort_values('total_amount', ascending= False)
print(dfvendedor[['total_amount'] + ['quantity']].head())
print('El mejor vendedor fue Janel O Curran con un total de ventas $ 192,832.47 y 703 unidades vendidas ')
print()
dfproducto = my_df.groupby(['article_name']).sum().sort_values('total_amount', ascending = False)
print(dfproducto[['total_amount'] + ['quantity']].head())
print('El producto con mas ventas fue Full PC con $ 538,335.93 y 253 unidades vendidas')
print(my_df['article_name'].unique())
lista= my_df['article_name'].unique()
print(len(lista))
lista= ['Water Cooling', 'Mouse' ,'Netbook' ,'Tablet', 'Case' ,'HDD' ,'SDD'
'Ram Memory', 'Sata Cable', 'Pci Express Port' ,'Usb Cable' ,'Full Pc'
'Range Extender', 'Desk', 'Wi-Fi Card', 'Motherboard', 'Video Card',
'Headphones', 'Modem' ,'Power Supply' ,'Keyboard', 'Webcam', 'Monitor' ,'CPU',
'Fan Cooler', 'Chair', 'Mesh Wi-Fi X 2', 'Smartphone' ,'Heatsink' ,'Scanner',
'Notebook']
mejores_vendedores=[]
best=[]
for i in range(len(lista)):
x= my_df['article_name']== lista[i]
xi= my_df[x]
xif= xi[['seller_name','article_name', 'quantity']].groupby('seller_name').sum().sort_values('quantity', ascending = False).head(1)
mejores_vendedores.append(xif)
best.append([ lista[i], xif])
print('Articulo', lista[i], xif)
print ()
lista2= [
['Water Cooling', 'Onida Cosely',56],
['Mouse', 'Kati' 'Innot' , 42],
['Netbook', 'Aveline Swanwick' ,48],
['Tablet', 'Brockie Patience' , 50],
['Case', 'Jase Doy' , 32],
['HDD', 'Janel O Curran' , 75],
['Sata Cable', 'Daisie Slograve' ,55],
['Pci Express Port', 'Aveline Swanwick', 44],
['Usb Cable', 'Cornie Wynrehame' , 41],
['Full PcRange Extender Desk' ,'Daisie Slograve' ,40],
['Wi-Fi Card' , 'Kati Innot' , 35],
['Motherboard' , 'Jase Doy' , 50],
['Video Card', 'Tobin Roselli' , 42],
['Headphones' ,'Oliviero Charkham', 51],
['Modem' , 'Cirilo Grandham' , 42],
['Power Supply' ,'Tobin Roselli', 58],
['Keyboard', 'Aveline Swanwick' , 36],
['Webcam' , 'Brockie Patience' , 27],
['Monitor' , 'Aveline Swanwick' , 60],
['CPU , Arnold Kilkenny' , 55],
['Fan Cooler' ,'Milly Christoffe' , 40],
['Chair', 'Daisie Slograve' , 36],
['Mesh Wi-Fi X 2', 'Aveline Swanwick' , 35],
['Smartphone', 'Milly Christoffe' , 47],
['Heatsink', 'Daisie Slograve' , 39],
['Scanner' , 'Arnold Kilkenny' , 27],
['Notebook' , 'Daisie Slograve' , 31]]
dfbestseller = pd.DataFrame(lista2, columns=['Artículo', 'Vendedor', 'Cantidad'])
pd.options.display.float_format= ' {:,.1f}'.format
print('Mejores vendedores por producto')
print(dfbestseller)
print(dfbestseller.dtypes)
filtro2 = (my_df['country_name'] == 'Mexico') | (my_df['country_name']=='Ecuador')
dfmex_ec= my_df[filtro2]
dfmex_ec2= dfmex_ec.groupby('country_name').sum().sort_values('quantity', ascending=False)
print(dfmex_ec2[['quantity'] + ['total_amount']])