I am analyzing a dataset in Python for strictly learning purpose. In the code below that I wrote, I am getting some errors which I cannot get rid off. Here is the code first:
plt.plot(decade_mean.index, decade_mean.values, 'o-',color='r',lw=3,label = 'Decade Average') plt.scatter(movieDF.year, movieDF.rating, color='k', alpha = 0.3, lw=2) plt.xlabel('Year') plt.ylabel('Rating') remove_border()
I am getting the following errors:
1. TypeError: 'str' object is not callable 2. NameError: name 'remove_border' is not defined
Also, the label='Decade Average' is not showing up in the plot.
What confuses me most is the fact that in a separate code snippet for plots (see below), I didn't get the 1st error above, although
remove_border was still a problem.
plt.hist(movieDF.rating, bins = 5, color = 'blue', alpha = 0.3) plt.xlabel('Rating')
Any explanations of all or some of the errors would be greatly appreciated. Thanks
Following the comments, I am posting the data and the traceback below: decade_mean is given below.
year 1970 8.925000 1980 8.650000 1990 8.615789 2000 8.378947 2010 8.233333 Name: rating, dtype: float64
TypeError Traceback (most recent call last) <ipython-input-361-a6efc7e46c45> in <module>() 1 plt.plot(decade_mean.index, decade_mean.values, 'o-',color='r',lw=3,label = 'Decade Average') 2 plt.scatter(movieDF.year, movieDF.rating, color='k', alpha = 0.3, lw=2) ----> 3 plt.xlabel('Year') 4 plt.ylabel('Rating') 5 remove_border() TypeError: 'str' object is not callable
I have solved remove_border problem. It was a stupid mistake I made. But I couldn't figure out the problem with the 'str'.