0

Iam tring to display the value of each bar, problem is that for each row there is 3 columns therefore 3 bars per row

So i can't just use this following code

import matplotlib.pyplot as plt
for i, v in enumerate(df.values):      
       plt.text(i, v, str(v), color='blue', fontweight='bold')

and results in error when try to df.plot() saying TypeError: only size-1 arrays can be converted to Python scalars


That's the df

import pandas as pd
df = pd.read_csv('https://cocl.us/datascience_survey_data')
df = df.set_index('Unnamed: 0')
df = df.sort_values(['Very interested'], ascending=False)
df = df / 2233 * 100
df = round(df, 2)

dataframe


This is my current plot

df.plot(kind='bar', color=['#5cb85c', '#5bc0de', '#d9534f'], width=0.8, figsize=(10, 8))

dataframe bar plotting


That's what iam tring to acheive

enter image description here


0 Answers0