from plotnine import *
import pandas as pd
from plotnine.data import *
median_age_dict={
'Country': ['New Zealand','Spain','Ireland','Israel','Denmark','Norway','Netherlands','Australia','Italy','Sweden'],
'Age': [39.0, 37.0, 35.0, 34.0, 34.0, 34.0, 34.0, 34.0, 34.0, 34.0]
}
median_age=pd.DataFrame(median_age_dict)
(ggplot(median_age,aes(x='Country',y='Age',fill='Country'))#创建图象,传入数据来源和映射
+ geom_bar(stat='identity')#建立几何对象,画直方图
)
也不报错