image_output_1.png
import matplotlib.pyplot as plt

import pandas as pd

import seaborn as sns

df = pd.read_csv('/kaggle/input/dataviz-facens-20182-ex3/BlackFriday.csv', delimiter=',')

fig, ax = plt.subplots(figsize=(18,9))
plt.title('Valor Gasto por Faixa Etária', fontsize=14, fontweight = 'bold')

frame = plt.gca()
frame.spines['right'].set_visible(False)
frame.spines['top'].set_visible(False) 

sns.violinplot(ax = ax, x="Age", y="Purchase", data=df[['Age','Purchase']].sort_values(by=['Age']),  palette="RdBu_r")

g = sns.catplot(x="Purchase", y="Gender", col="Age",
                data=df.sort_values(by=['Age']), col_wrap=1,
                orient="h", height=3, aspect=3, palette="Set3",
                kind="violin", dodge=True, bw=.2)

import numpy as np
total = pd.DataFrame(df.Product_ID.value_counts()).head(9)
x = total.index.unique()
y = total.Product_ID
width = 0.8
fig, ax = plt.subplots()
ax.barh(x, y, width, color='#AAAAAA')
frame = plt.gca()
frame.spines['right'].set_visible(False)
frame.spines['top'].set_visible(False)
for i, v in enumerate(y):
    ax.text(v / 2, i, str(v), color='#111111', fontweight='bold', verticalalignment='center')
ax.invert_yaxis()
fig.set_size_inches(15, 8)
plt.title('Top 9 Produtos mais Comprados', fontsize=14, fontweight='bold')
plt.show()