Issue
I encountered with this error: TypeError: 'str' object is not callable
when trying to add a label on Y axis for my bar chart. Why? please help. Here's the code:
import pandas as pd
import matplotlib.pyplot as plt
# TODO: Plot company with the most stock and the lowest stock
data = pd.read_csv("c:\\users\\HP\\Downloads\\Stock.csv")
plt.bar(1,data['Stock'].max(), label=data['Company'].max())
plt.bar(1,data['Stock'].min(), label=data['Company'].min())
plt.ylabel("Stock")
plt.legend()
Full error:
TypeError Traceback (most recent call last)
<ipython-input-32-136cc5c2aaf2> in <module>
5 plt.bar(1,data['Stock'].max(), label=data['Company'].max())
6 plt.bar(1,data['Stock'].min(), label=data['Company'].min())
----> 7 plt.ylabel("Stock")
8 plt.legend()
TypeError: 'str' object is not callable
Solution
Try restarting the Kernel. This sometimes help
Answered By - gtomer
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.