Pandas does not recognize installed matplotlib library
import pandas as pd
import numpy as np
import matplotlib.pyplot as plt
%matplotlib inline
ts = pd.Series(np.random.randn(1000), index=pd.date_range('1/1/2000', periods=1000))
ts = ts.cumsum()
ts.plot()
c:\users\xxxxx\appdata\local\programs\python\python36\lib\site-packages\pandas\plotting\_core.py in _raise_if_no_mpl()
     55     # TODO(mpl_converter): remove once converter is explicit
     56     if not _HAS_MPL:
---> 57         raise ImportError("matplotlib is required for plotting.")
     58 
     59    
ImportError: matplotlib is required for plotting.
                Installing matplotlib before installing pandas again made it work.
I got the same error in Jupyter Lab. The solution is (after install of matplotlib):
Click Restart the Kernel button in the toolbar;
or
Choose menu item Kernel=>Restart Kernel and Run All Cells..., and click Restart in the confirmation dialog
Done!
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