'Ploting with seaborn histplot

I'm on Jupyter trying to plot a slice of a DataFrame with the following values: Female = 16092 and Male = 27895

sexo = df2.groupby(['Sexo']).size()
sexo

Sexo
F    16092
M    27895
dtype: int64


fig, axs = plt.subplots(1, figsize=[8,8])
sns.histplot(data=sexo, x='Sexo', y=sexo)
plt.show()

But the graph doesn't plot bars with a size relative to the values, just two squares covering a large number of values. (I can't post pictures here in Stack Overflow yet).

I'm probably feeding the histplot with wrong data or should be using another graph.

Thanks in advance.



Solution 1:[1]

try using value_count for discrete categories

df['target'].value_counts()

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Golden Lion