I'm a Python 3.6 user and I've been trying to learn how to use the matplotlib and pandas libraries. But as I try to use the "show()" function, I get the following error:
import pandas as pd import matplotlib as plt df=pd.DataFrame({'Day':[1,2,3], 'Revenue':[100,200,320]}) df.plot() plt.show() ERROR: AttributeError: module 'matplotlib' has no attribute 'show'
Do not use
import matplotlib as plt but rather use
import matplotlib.pyplot as plt plt is an abbreviation for pyplot, which is a module inside the matplotlib package. You need to address it for the kinds of things you are doing, not just matplotlib.
Note that matplotlib can be used without using pyplot at all, but most people find it easier to use pyplot. See its documentation or the tutorial for details.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With