Unable to use matplotlib
Answered
I have downloaded matplotlib through my python terminal, in addition, I have anaconda installed on my computer. I am trying to execute this code, although the second and fourth line are greyed out, and thus cannot be run. I have tried deleting these lines and the green play button is still grey.
import datetime as dt
import matplotlib.pyplot as plt
from matplotlib import style
import pandas as pd
import pandas_datareader.data as web
style.use('ggplot')
start = dt.datetime(2015, 1, 1)
end = dt.datetime.now()
df = web.DataReader("TSLA", 'morningstar', start, end)
df.reset_index(inplace=True)
df.set_index("Date", inplace=True)
df = df.drop("Symbol", axis=1)
print(df.head())
Please sign in to leave a comment.
Hi,
Have you created Run/Debug configuration for your script?
If not, you can right-click the file and choose Run...
Yes, but it still says that there is no module named matplotlib, even though I dowloaded it through the terminal.
Most likely you installed it to your system interpreter and in PyCharm you use another interpreter (venv apparently).
Follow this tutorial to install matplotlib to your current Project Interpreter https://www.jetbrains.com/help/pycharm/installing-uninstalling-and-upgrading-packages.html
I was able to install both Matplotlib and pandas, but it is now giving the the following message when I try to run the code:
Try running it from the system terminal (outside of PyCharm) using the same interpreter. Do you get the same error?