I used agg to find mean and min values grouped by age. Then tried to plot area filled line graph.
grpby = df6.groupby('age')
mean_values = grpby.agg({'hoursperweek':np.mean})
min_values = grpby.agg({'hoursperweek':np.min})
from matplotlib import pyplot as plt
plt.plot(mean_values,label = 'mean')
plt.plot(min_values,label = 'min',linestyle = '--')
plt.fill_between(mean_values,alpha = 0.25)
plt.legend()
plt.title('Mean and min')
plt.xlabel('ages')
plt.ylabel('hrs per week')
plt.show()
My mean values output :
     hoursperweek
age              
31      42.877252
32      42.878019
33      42.965714
34      42.937923
35      43.908676
36      43.257238
37      43.706294
...
...
I'm getting the following error
    plt.fill_between(mean_values,alpha = 0.25)
TypeError: fill_between() missing 1 required positional argument: 'y1'
How to solve this?
 
    