0

I am trying to simply add the numbers at the end of the columns.

x = df['Gender'].index
y = df['Gender'].values
plt.figure(figsize=(8,4))
sns.barplot(x,y)
plt.show()
df['Gender'].value_counts()

for index, value in enumerate(y):
    plt.text(value, index, str(value))

my error:

ConversionError: Failed to convert value(s) to axis units: 'Female'

  • can you share some sample data please? When you say "I am trying to simply add the numbers at the end of the columns." do you mean you are trying to add data labels to the barplot? Did you see this question https://stackoverflow.com/questions/43214978/seaborn-barplot-displaying-values ? Or https://stackoverflow.com/a/62012733/6366770 – David Erickson Apr 09 '21 at 18:58
  • I want the sum for the column "Gender" and they only have the entries "Male" and "Female" – user13682040 Apr 09 '21 at 19:08
  • total numbers are 501 female and 499 male. I have tried some of the examples from other pages, but they lead me to my error which I do not quite understand – user13682040 Apr 09 '21 at 19:09

0 Answers0