# Levanto los datos en 3 diferentes dataframes
# ARTÍCULOS
conn = sql3.connect('/work/data/articles.db')
sql_query = pd.read_sql_query('SELECT * FROM articles', conn)
df_articles = pd.DataFrame(sql_query, columns=['article_id','article_name','unit_price'])
print(df_articles)
article_id article_name unit_price
0 20015 Smartphone 525.00
1 20016 Full Pc 2127.81
2 20017 Monitor 230.00
3 20018 Tablet 130.00
4 20019 Desk 130.10
5 20020 Chair 335.64
6 20021 Modem 67.50
7 20022 Range Extender 20.45
8 20023 Notebook 1000.00
9 20024 Netbook 145.00
10 20025 HDD 54.62
11 20026 SDD 22.00
12 20027 Ram Memory 35.95
13 20028 Motherboard 138.38
14 20029 Mouse 30.30
15 20030 Fan Cooler 4.25
16 20031 Webcam 20.07
17 20032 Keyboard 22.60
18 20033 Headphones 23.30
19 20034 Scanner 185.00
20 20035 Case 37.90
21 20036 Video Card 131.50
22 20037 CPU 139.62
23 20038 Power Supply 43.95
24 20039 Water Cooling 67.50
25 20040 Heatsink 10.00
26 20041 Usb Cable 2.95
27 20042 Sata Cable 2.14
28 20043 Pci Express Port 10.12
29 20044 Wi-Fi Card 59.61
30 20045 Mesh Wi-Fi X 2 32.50
# VENDEDORES
df_sellers = pd.read_excel('/work/data/sellers.xlsx', index_col=0)
print(df_sellers)
seller_name
seller_id
1 Aveline Swanwick
2 Jase Doy
3 Oliviero Charkham
4 Cornie Wynrehame
5 Ewell Peres
6 Milly Christoffe
7 Kati Innot
8 Tobin Roselli
9 Onida Cosely
10 Cirilo Grandham
11 Vasily Danilyuk
12 Brockie Patience
13 Arnold Kilkenny
14 Janel O'Curran
15 Daisie Slograve
# ÓRDENES
df_orders = pd.read_csv('/work/data/orders.csv')
print(df_orders)
order_id week article_id quantity seller_id country_name
0 15024 1 20039 10 10 Peru
1 15025 1 20029 15 5 Peru
2 15026 1 20024 5 14 Bolivia
3 15027 1 20018 9 14 Brazil
4 15028 1 20035 6 15 Mexico
.. ... ... ... ... ... ...
995 16019 4 20021 1 7 Brazil
996 16020 4 20040 15 15 Brazil
997 16021 4 20040 2 11 Colombia
998 16022 4 20018 14 11 Brazil
999 16023 4 20026 12 9 Brazil
[1000 rows x 6 columns]
# Exploración del df de artículos
print('Muestra de datos')
print(df_articles.head())
print('\nFormato del dataframe')
print(df_articles.shape)
print('\nBúsqueda de valores nulos')
print(df_articles.isnull().sum())
print('\nFormato de los datos')
print(df_articles.dtypes)
Muestra de datos
article_id article_name unit_price
0 20015 Smartphone 525.00
1 20016 Full Pc 2127.81
2 20017 Monitor 230.00
3 20018 Tablet 130.00
4 20019 Desk 130.10
Formato del dataframe
(31, 3)
Búsqueda de valores nulos
article_id 0
article_name 0
unit_price 0
dtype: int64
Formato de los datos
article_id int64
article_name object
unit_price object
dtype: object
# Exploración del df de vendedores
print('Muestra de datos')
print(df_sellers.head())
print('\nFormato del dataframe')
print(df_sellers.shape)
print('\nBúsqueda de valores nulos')
print(df_sellers.isnull().sum())
print('\nFormato de los datos')
print(df_sellers.dtypes)
Muestra de datos
seller_name
seller_id
1 Aveline Swanwick
2 Jase Doy
3 Oliviero Charkham
4 Cornie Wynrehame
5 Ewell Peres
Formato del dataframe
(15, 1)
Búsqueda de valores nulos
seller_name 0
dtype: int64
Formato de los datos
seller_name object
dtype: object
# Exploración del df de órdenes
print('Muestra de datos')
print(df_orders.head())
print('\nFormato del dataframe')
print(df_orders.shape)
print('\nBúsqueda de valores nulos')
print(df_orders.isnull().sum())
print('\nFormato de los datos')
print(df_orders.dtypes)
Muestra de datos
order_id week article_id quantity seller_id country_name
0 15024 1 20039 10 10 Peru
1 15025 1 20029 15 5 Peru
2 15026 1 20024 5 14 Bolivia
3 15027 1 20018 9 14 Brazil
4 15028 1 20035 6 15 Mexico
Formato del dataframe
(1000, 6)
Búsqueda de valores nulos
order_id 0
week 0
article_id 0
quantity 0
seller_id 0
country_name 0
dtype: int64
Formato de los datos
order_id int64
week int64
article_id int64
quantity int64
seller_id int64
country_name object
dtype: object
df_articles['unit_price'] = df_articles['unit_price'].astype(float)
print(df_articles.dtypes)
article_id int64
article_name object
unit_price float64
dtype: object
# Creo una copia del df_orders
my_df = df_orders.copy()
# Cambio el índice del df_articles
df_articles.set_index('article_id', inplace=True)
print(df_articles.head())
article_name unit_price
article_id
20015 Smartphone 525.00
20016 Full Pc 2127.81
20017 Monitor 230.00
20018 Tablet 130.00
20019 Desk 130.10
order_id week article_id quantity seller_id country_name
0 15024 1 20039 10 10 Peru
1 15025 1 20029 15 5 Peru
2 15026 1 20024 5 14 Bolivia
3 15027 1 20018 9 14 Brazil
4 15028 1 20035 6 15 Mexico
# agrego las columnas que me faltan
my_df = my_df.assign(article_name = my_df['article_id'])
my_df = my_df.assign(total_amount = my_df['article_id'])
my_df = my_df.assign(seller_name = my_df['seller_id'])
print(my_df.head())
order_id week article_id quantity seller_id country_name article_name \
0 15024 1 20039 10 10 Peru 20039
1 15025 1 20029 15 5 Peru 20029
2 15026 1 20024 5 14 Bolivia 20024
3 15027 1 20018 9 14 Brazil 20018
4 15028 1 20035 6 15 Mexico 20035
total_amount seller_name
0 20039 10
1 20029 5
2 20024 14
3 20018 14
4 20035 15
# reemplazar los datos ne las nuevas columnas
for i in range(len(my_df.index)):
# columna article_name
# cargo el nombre del artículo en una variable
article = df_articles.loc[my_df.loc[i]['article_name']]['article_name']
# se lo asigno a la columna y registro que corresponde
my_df.loc[i,'article_name']= article
# columna total_amount
my_df.loc[i,'total_amount'] = my_df.loc[i,'quantity'] * df_articles.loc[my_df.loc[i]['article_id']]['unit_price']
# columna de seller_name
my_df.loc[i,'seller_name'] = df_sellers.loc[my_df.loc[i]['seller_name']]['seller_name']
print(my_df.head())
order_id week article_id quantity seller_id country_name \
0 15024 1 20039 10 10 Peru
1 15025 1 20029 15 5 Peru
2 15026 1 20024 5 14 Bolivia
3 15027 1 20018 9 14 Brazil
4 15028 1 20035 6 15 Mexico
article_name total_amount seller_name
0 Water Cooling 675.0 Cirilo Grandham
1 Mouse 454.5 Ewell Peres
2 Netbook 725.0 Janel O'Curran
3 Tablet 1170.0 Janel O'Curran
4 Case 227.4 Daisie Slograve
# elimino las columnas que no necesito
my_df.drop(['order_id', 'article_id','seller_id'], axis='columns', inplace=True)
print(my_df.head())
week quantity country_name article_name total_amount seller_name
0 1 10 Peru Water Cooling 675.0 Cirilo Grandham
1 1 15 Peru Mouse 454.5 Ewell Peres
2 1 5 Bolivia Netbook 725.0 Janel O'Curran
3 1 9 Brazil Tablet 1170.0 Janel O'Curran
4 1 6 Mexico Case 227.4 Daisie Slograve
d1=pd.DataFrame({'mes': ['ene','feb','mar','abr'], 'ventas':[10,20,30,15]})
d2=pd.DataFrame({'mes': ['ene','feb','mar','abr'], 'costos':[7,16,25,12]})
print(pd.merge(d1,d2))
mes ventas costos
0 ene 10 7
1 feb 20 16
2 mar 30 25
3 abr 15 12
# RESOLUCIÓN ANALÍTICA
my_df2 = my_df.groupby('article_name').sum()
por_cant = my_df2.sort_values('quantity', ascending=False)
print(por_cant['quantity'].head(1))
article_name
HDD 413
Name: quantity, dtype: int64
# RESOLUCIÓN GRÁFICA
sns.displot(my_df, x='article_name')
plt.xticks(rotation=90)
plt.show()
# RESOLUCIÓN ANALÍTICA
my_df3 = (my_df.groupby('article_name').sum()).sort_values('total_amount', ascending=False).head(5)
print(my_df3['total_amount'])
article_name
Full Pc 538335.93
Notebook 251000.00
Smartphone 152250.00
Chair 69477.48
Tablet 48620.00
Name: total_amount, dtype: float64
# RESOLUCIÓN GRÁFICA
plt.pie(x=my_df3['total_amount'],labels=my_df3.index)
plt.show()
# RESOLUCIÓN ANALÍTICA
df4 = (my_df.groupby('seller_name').sum()).sort_values('total_amount', ascending=False)
print(df4[['quantity']+['total_amount']])
quantity total_amount
seller_name
Janel O'Curran 703 192832.47
Brockie Patience 441 142709.88
Oliviero Charkham 555 141329.76
Vasily Danilyuk 521 129157.55
Daisie Slograve 554 120520.11
Aveline Swanwick 629 118874.33
Arnold Kilkenny 583 94552.04
Kati Innot 512 83704.62
Jase Doy 582 80628.31
Ewell Peres 496 78144.32
Onida Cosely 535 77373.37
Milly Christoffe 442 61733.69
Tobin Roselli 519 56984.42
Cornie Wynrehame 523 52253.57
Cirilo Grandham 470 45009.40
# RESOLUCIÓN GRÁFICA
plt.bar(df4.index, df4['total_amount'])
plt.xticks(rotation=60)
plt.show()
# RESOLUCIÓN ANALÍTICA
df5=(my_df.groupby('week').sum()).sort_values('total_amount',ascending=False)
print(df5)
quantity total_amount
week
1 2449 507458.81
2 2444 415364.44
3 2114 329140.03
4 1058 223844.56
# RESOLUCIÓN GRÁFICA
plt.bar(df5.index,df5['total_amount'])
plt.show()
# RESOLUCIÓN
my_df6 = (my_df.groupby('country_name').sum()).sort_values('total_amount', ascending=False).head(3)
print(my_df6['total_amount'])
country_name
Brazil 441271.85
Argentina 205832.78
Colombia 177514.29
Name: total_amount, dtype: float64
# RESOLUCIÓN
my_df7 = (my_df.groupby(['country_name', 'article_name']).sum()).sort_values('quantity', ascending=False)
#my_df7.groupby('article_name').sum().sort_values('quantity', ascending=False).head()
#print(my_df7['quantity'])
print(my_df7['quantity'])
country_name article_name
Brazil Tablet 156
Peru Mouse 125
Brazil HDD 119
SDD 117
Chair 112
...
Ecuador SDD 1
Modem 1
Heatsink 1
Paraguay Video Card 1
Chile Netbook 1
Name: quantity, Length: 306, dtype: int64
# RESOLUCIÓN
my_df8 = (my_df.groupby('article_name').sum()).sort_values('total_amount', ascending=True).head(3)
print(my_df8['total_amount'])
article_name
Sata Cable 564.96
Usb Cable 805.35
Fan Cooler 871.25
Name: total_amount, dtype: float64
Zona Experimental
ff = my_df[((my_df['article_name'] == 'Full Pc') |(my_df['article_name'] == 'Notebook')) & ((my_df['country_name'] == 'Argentina') | (my_df['country_name']=='Brazil'))]
print(ff)
week quantity country_name article_name total_amount seller_name
16 1 6 Brazil Full Pc 12766.86 Arnold Kilkenny
38 1 2 Brazil Full Pc 4255.62 Jase Doy
70 1 5 Brazil Full Pc 10639.05 Jase Doy
108 1 13 Brazil Notebook 13000.00 Arnold Kilkenny
112 1 9 Brazil Full Pc 19150.29 Janel O'Curran
114 1 4 Brazil Notebook 4000.00 Ewell Peres
142 1 11 Argentina Notebook 11000.00 Vasily Danilyuk
160 1 12 Brazil Full Pc 25533.72 Daisie Slograve
162 1 4 Brazil Notebook 4000.00 Aveline Swanwick
193 1 6 Argentina Notebook 6000.00 Aveline Swanwick
212 1 5 Argentina Full Pc 10639.05 Onida Cosely
283 1 10 Argentina Full Pc 21278.10 Oliviero Charkham
299 2 15 Argentina Full Pc 31917.15 Brockie Patience
313 2 8 Brazil Full Pc 17022.48 Vasily Danilyuk
330 2 1 Argentina Notebook 1000.00 Kati Innot
350 2 10 Argentina Notebook 10000.00 Tobin Roselli
413 2 12 Brazil Full Pc 25533.72 Aveline Swanwick
420 2 9 Brazil Notebook 9000.00 Daisie Slograve
440 2 11 Argentina Full Pc 23405.91 Janel O'Curran
523 2 2 Brazil Full Pc 4255.62 Aveline Swanwick
644 3 2 Brazil Full Pc 4255.62 Arnold Kilkenny
652 3 8 Argentina Notebook 8000.00 Daisie Slograve
702 3 2 Argentina Notebook 2000.00 Oliviero Charkham
785 3 5 Brazil Full Pc 10639.05 Aveline Swanwick
867 3 12 Brazil Notebook 12000.00 Onida Cosely
915 4 5 Argentina Notebook 5000.00 Arnold Kilkenny
930 4 4 Argentina Full Pc 8511.24 Vasily Danilyuk
933 4 14 Brazil Notebook 14000.00 Tobin Roselli
935 4 14 Brazil Notebook 14000.00 Daisie Slograve
936 4 13 Brazil Notebook 13000.00 Kati Innot
sns.barplot(x='country_name', y='quantity', hue='week', data=ff)
df40 = (my_df.groupby(['article_name','week']).sum()).sort_values('quantity', ascending=False)
print(df40)
quantity total_amount
article_name week
HDD 2 158 8629.96
SDD 1 153 3366.00
Tablet 3 148 19240.00
HDD 3 129 7045.98
Mouse 2 125 3787.50
... ... ...
Keyboard 4 14 316.40
Case 4 13 492.70
Wi-Fi Card 4 10 596.10
Desk 4 6 780.60
Scanner 4 1 185.00
[124 rows x 2 columns]
paises=df40.index.get_level_values(0)
#df40.loc[('Brazil','Chair')]
paises
my_df6=(my_df.groupby('country_name').sum()).sort_values('total_amount',ascending=False).head(5)
print(my_df6[['quantity']+['total_amount']])
# RESOLUCIÓN GRÁFICA
fig, graf5 = plt.subplots()
graf5.bar(my_df6.index,my_df6['total_amount'])
graf5.plot(my_df6['total_amount'])
graf5.yaxis.set_tick_params(labelleft=False,labelright=True)
graf5.xaxis.set_tick_params(rotation=30)
sns.set_palette('coolwarm')
plt.title('Top Mejores 5 Países en Ventas', size=18, fontweight='bold')
plt.ylabel('Total $ Vendido',fontstyle='italic',fontsize=14, fontweight='bold')
plt.xlabel('País',fontstyle='oblique',fontsize=14, fontweight='heavy')
plt.show()
quantity total_amount
country_name
Brazil 2515 441271.85
Argentina 947 205832.78
Colombia 881 177514.29
Peru 1027 161421.12
Mexico 846 138619.99
plt.pie(x=my_df3['total_amount'],labels=my_df3.index, startangle=90)
plt.legend(my_df3['total_amount'],loc='upper left')
centre_cicle = plt.Circle((0,0),0.4, fc='white')
fig=plt.gcf()
fig.gca().add_artist(centre_cicle)
plt.title('Artículos que proporcionaron mayores ingresos')
plt.show()
art2 = my_df[(my_df['article_name']== 'Notebook') | (my_df['article_name']== 'Full Pc') & ((my_df['country_name'] == 'Argentina') | (my_df['country_name']=='Brazil'))]
print(art2)
week quantity country_name article_name total_amount seller_name
16 1 6 Brazil Full Pc 12766.86 Arnold Kilkenny
38 1 2 Brazil Full Pc 4255.62 Jase Doy
70 1 5 Brazil Full Pc 10639.05 Jase Doy
103 1 13 Peru Notebook 13000.00 Cornie Wynrehame
108 1 13 Brazil Notebook 13000.00 Arnold Kilkenny
112 1 9 Brazil Full Pc 19150.29 Janel O'Curran
114 1 4 Brazil Notebook 4000.00 Ewell Peres
142 1 11 Argentina Notebook 11000.00 Vasily Danilyuk
160 1 12 Brazil Full Pc 25533.72 Daisie Slograve
162 1 4 Brazil Notebook 4000.00 Aveline Swanwick
167 1 6 Colombia Notebook 6000.00 Milly Christoffe
193 1 6 Argentina Notebook 6000.00 Aveline Swanwick
212 1 5 Argentina Full Pc 10639.05 Onida Cosely
215 1 15 Guatemala Notebook 15000.00 Janel O'Curran
262 1 7 Colombia Notebook 7000.00 Kati Innot
282 1 14 Honduras Notebook 14000.00 Oliviero Charkham
283 1 10 Argentina Full Pc 21278.10 Oliviero Charkham
289 1 2 Guatemala Notebook 2000.00 Janel O'Curran
299 2 15 Argentina Full Pc 31917.15 Brockie Patience
301 2 5 Colombia Notebook 5000.00 Aveline Swanwick
313 2 8 Brazil Full Pc 17022.48 Vasily Danilyuk
330 2 1 Argentina Notebook 1000.00 Kati Innot
350 2 10 Argentina Notebook 10000.00 Tobin Roselli
363 2 7 Mexico Notebook 7000.00 Ewell Peres
413 2 12 Brazil Full Pc 25533.72 Aveline Swanwick
420 2 9 Brazil Notebook 9000.00 Daisie Slograve
440 2 11 Argentina Full Pc 23405.91 Janel O'Curran
491 2 5 Peru Notebook 5000.00 Brockie Patience
523 2 2 Brazil Full Pc 4255.62 Aveline Swanwick
633 3 5 Mexico Notebook 5000.00 Arnold Kilkenny
644 3 2 Brazil Full Pc 4255.62 Arnold Kilkenny
652 3 8 Argentina Notebook 8000.00 Daisie Slograve
696 3 6 Peru Notebook 6000.00 Cornie Wynrehame
702 3 2 Argentina Notebook 2000.00 Oliviero Charkham
703 3 8 Peru Notebook 8000.00 Milly Christoffe
785 3 5 Brazil Full Pc 10639.05 Aveline Swanwick
867 3 12 Brazil Notebook 12000.00 Onida Cosely
894 4 9 Mexico Notebook 9000.00 Kati Innot
896 4 9 Mexico Notebook 9000.00 Aveline Swanwick
915 4 5 Argentina Notebook 5000.00 Arnold Kilkenny
930 4 4 Argentina Full Pc 8511.24 Vasily Danilyuk
933 4 14 Brazil Notebook 14000.00 Tobin Roselli
935 4 14 Brazil Notebook 14000.00 Daisie Slograve
936 4 13 Brazil Notebook 13000.00 Kati Innot
989 4 14 Mexico Notebook 14000.00 Vasily Danilyuk
my_df60=(ff.groupby('country_name').sum()).sort_values('total_amount',ascending=False)
print(my_df60)
week quantity total_amount
country_name
Brazil 37 146 217052.03
Argentina 26 88 138751.45
smarts = my_df[(my_df['article_name']== 'Smartphone')]
sa=(smarts.groupby('country_name').sum()).sort_values('total_amount',ascending=False)
print(sa)
week quantity total_amount
country_name
Brazil 19 79 41475.0
Colombia 13 52 27300.0
Venezuela 10 32 16800.0
Mexico 6 29 15225.0
Argentina 5 25 13125.0
El Salvador 7 22 11550.0
Ecuador 4 15 7875.0
Peru 5 15 7875.0
Chile 3 12 6300.0
Uruguay 2 9 4725.0
# CONSULTA 13/7
# Graficando doble agrupamiento
ff=my_df[((my_df['country_name']=='Argentina') | (my_df['country_name']=='Brazil')) & ((my_df['article_name']=='Full Pc')|(my_df['article_name']=='Notebook')) ]
ff = ff.groupby(["article_name","country_name"]).sum().sort_values('total_amount',ascending=False)
# para facilitar la gráfica, uno de los índices que me quedaron después del agrupamiento, lo puedo convertir a columna nuevamente
ff.reset_index('article_name', inplace=True)
print(ff)
sns.barplot(ff.index.get_level_values(0), 'total_amount', data =ff, hue='article_name')
article_name week quantity total_amount
country_name
Brazil Full Pc 17 63 134052.03
Argentina Full Pc 10 45 95751.45
Brazil Notebook 20 83 83000.00
Argentina Notebook 16 43 43000.00
/shared-libs/python3.9/py/lib/python3.9/site-packages/seaborn/_decorators.py:36: FutureWarning: Pass the following variables as keyword args: x, y. From version 0.12, the only valid positional argument will be `data`, and passing other arguments without an explicit keyword will result in an error or misinterpretation.
warnings.warn(
df9 = my_df.groupby(["country_name","article_name"]).sum()
prod_cant = df9.sort_values("quantity", ascending=False)
print(prod_cant)
print(prod_cant.loc[('Peru','Mouse')]['quantity'])
week quantity total_amount
country_name article_name
Brazil Tablet 41 156 20280.00
Peru Mouse 23 125 3787.50
Brazil HDD 45 119 6499.78
SDD 33 117 2574.00
Chair 32 112 37591.68
... ... ... ...
Ecuador SDD 2 1 22.00
Modem 1 1 67.50
Heatsink 2 1 10.00
Paraguay Video Card 3 1 131.50
Chile Netbook 2 1 145.00
[306 rows x 3 columns]
125.0
# GRÁFICA BARRAS APILADAS
my_df8 = my_df[(my_df['article_name'] == 'Full Pc') | (my_df['article_name'] == 'Notebook')| (my_df['article_name'] == 'Tablet')| (my_df['article_name'] == 'Smartphone')| (my_df['article_name'] == 'Chair')]
print(my_df8)
my_df8b=(my_df8.groupby(['seller_name','article_name']).sum()).sort_values('quantity',ascending=False)
print(my_df8b)
week quantity country_name article_name total_amount seller_name
3 1 9 Brazil Tablet 1170.00 Janel O'Curran
16 1 6 Brazil Full Pc 12766.86 Arnold Kilkenny
20 1 10 Colombia Tablet 1300.00 Daisie Slograve
22 1 15 Venezuela Tablet 1950.00 Arnold Kilkenny
38 1 2 Brazil Full Pc 4255.62 Jase Doy
.. ... ... ... ... ... ...
985 4 10 Brazil Tablet 1300.00 Milly Christoffe
988 4 13 Colombia Full Pc 27661.53 Janel O'Curran
989 4 14 Mexico Notebook 14000.00 Vasily Danilyuk
993 4 8 Brazil Chair 2685.12 Oliviero Charkham
998 4 14 Brazil Tablet 1820.00 Vasily Danilyuk
[163 rows x 6 columns]
week quantity total_amount
seller_name article_name
Janel O'Curran Full Pc 13 56 119157.36
Brockie Patience Tablet 11 50 6500.00
Oliviero Charkham Tablet 13 49 6370.00
Milly Christoffe Smartphone 12 47 24675.00
Brockie Patience Full Pc 10 46 97879.26
... ... ... ...
Aveline Swanwick Tablet 4 4 520.00
Cornie Wynrehame Chair 2 2 671.28
Vasily Danilyuk Chair 4 1 335.64
Cirilo Grandham Full Pc 3 1 2127.81
Jase Doy Smartphone 1 1 525.00
[65 rows x 3 columns]
my_df8b.reset_index(inplace=True)
print(my_df8b)
seller_name article_name week quantity total_amount
0 Janel O'Curran Full Pc 13 56 119157.36
1 Brockie Patience Tablet 11 50 6500.00
2 Oliviero Charkham Tablet 13 49 6370.00
3 Milly Christoffe Smartphone 12 47 24675.00
4 Brockie Patience Full Pc 10 46 97879.26
.. ... ... ... ... ...
60 Aveline Swanwick Tablet 4 4 520.00
61 Cornie Wynrehame Chair 2 2 671.28
62 Vasily Danilyuk Chair 4 1 335.64
63 Cirilo Grandham Full Pc 3 1 2127.81
64 Jase Doy Smartphone 1 1 525.00
[65 rows x 5 columns]
s1= sns.barplot(x='seller_name',y='quantity',data=my_df8b)
s2= sns.barplot(x='seller_name',y='quantity',data=my_df8b)
plt.xticks(rotation=90)
plt.show()
vendedores = ['vendedor A', 'vendedor B', 'vendedor C', 'vendedor D']
full_pc = [120,544,254,235]
notebook = [45,55,45,221]
indice = np.arange(len(vendedores))
plt.bar(indice, full_pc, label='Full PC')
plt.bar(indice, notebook, label='Full PC')
plt.xticks(indice, vendedores)
plt.xlabel("Vendedor")
plt.show()