AttributeError:'NoneType'对象在plt.hist中没有属性'update'

时间:2018-12-08 14:15:05

标签: python pandas matplotlib

我想绘制2个变量。一个是分类的,另一个是数值。

gender  race/ethnicity  parental level of education     lunch           test preparation course     math score  reading score   writing score
108     Female  Group B     Associate'S Degree          Free/Reduced    None                        52          76              70
231     Male    Group C     Associate'S Degree          Standard        None                        46          43              42
764     Male    Group D     Some College                Standard        None                        60          63              59
0       Female  Group B     Bachelor'S Degree           Standard        None                        72          72              74
885     Female  Group C     Associate'S Degree          Standard        Completed                   62          76              80
419     Male    Group E     High School                 Free/Reduced    Completed                   57          56              54


df.info()
<class 'pandas.core.frame.DataFrame'>
RangeIndex: 1000 entries, 0 to 999
Data columns (total 8 columns):
gender                         1000 non-null object
race/ethnicity                 1000 non-null category
parental level of education    1000 non-null category
lunch                          1000 non-null object
test preparation course        1000 non-null object
math score                     1000 non-null int64
reading score                  1000 non-null int64
writing score                  1000 non-null int64
dtypes: category(2), int64(3), object(3)
memory usage: 49.3+ KB

plt.hist(data=df, x="education",y="math score")

output error:
"AttributeError: 'NoneType' object has no attribute 'update'

有人知道我做错了吗?

0 个答案:

没有答案