#PYTHON PROGRAM TO IMPLEMENT GROUPED BAR PLOT
1. load iris dataset
2. Groupby species(setosa,versicolor,virginica)
3. find the mean of all the 4 features(sepal length,sepal width,petal length,petal width) with species as index
4. plot the bar chart accordingly
import matplotlib.pyplot as plt
import pandas as pd
df_species_flower = pd.read_csv('C:\Vinuthna\python_enthu\iris.csv')
#REFREAMED DATAFRAME BASED ON MEAN OF ALL FEATURES AND GROUPED BY SPECIES
avg_species_df = df_species_flower.groupby('species').mean().reset_index()
print(avg_species_df)
plt.bar(x=[0,5,10],height=avg_species_df['sepal_length'],width=0.3,color='green')
plt.bar(x=[0.3,5.3,10.3],height=avg_species_df['sepal_width'],width=0.3,color='red')
plt.bar(x=[0.6,5.6,10.6],height=avg_species_df['petal_length'],width=0.3,color='cyan')
plt.bar(x=[0.9,5.9,10.9],height=avg_species_df['petal_width'],width=0.3,color='blue')
plt.xlabel("SPECIES")
plt.ylabel("MEAN OF FLOWER DIMENSIONS")
plt.title("IRIS DATASET GROUPED BAR PLOT")
plt.legend(['sepal length','sepal width','petal length','petal_width'])