[英]'function' object has no attribute 'plot'
I was following this tutorial https://www.kaggle.com/residentmario/univariate-plotting-with-pandas and trying to do the exercise mentioned with the pokemon database but whenever I try to implement the code below I get the error mentioned below and don't understand what to do. 我正在按照本教程https://www.kaggle.com/residentmario/univariate-plotting-with-pandas进行尝试,并尝试通过pokemon数据库进行上述练习,但是每当尝试实现下面的代码时,我都会得到下面提到的错误而且不知道该怎么办。 I am using matplotlib.use('agg') because I was getting an error related to Tkinter.
我正在使用matplotlib.use('agg'),因为我遇到了与Tkinter相关的错误。 I am using pycharm, python 3.6 and I am on ubuntu 18.04
我正在使用pycharm,python 3.6,并且在ubuntu 18.04上
Here is my code: 这是我的代码:
import pandas as pd
import matplotlib
matplotlib.use('agg')
from matplotlib.pyplot import plot
df=pd.read_csv("/home/mv/PycharmProjects/visualization/pokemon.csv")
df['type1'].value_counts.plot(kind='bar')
error 错误
Traceback (most recent call last):
File "/home/mv/PycharmProjects/visualization/univariate plotting.py",
line 9, in <module>
df['type1'].value_counts.plot(kind='bar')
AttributeError: 'function' object has no attribute 'plot'
The error states that df['type1'].value_counts
is a function. 该错误指出
df['type1'].value_counts
是一个函数。
To plot the result of the function change: 绘制函数更改的结果:
df['type1'].value_counts.plot(kind='bar')
into 成
df['type1'].value_counts().plot(kind='bar')
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.