Search code examples
pythonpandasdataframefinance

mathplotlib.finance error in python


So I was trying to create some candlestick charts in python using the code presented here. But when I run it I get this error:

/usr/lib/python3.6/site-packages/matplotlib/cbook.py:136: MatplotlibDeprecationWarning: The finance module has been deprecated in mpl 2.0 and will be removed in mpl 2.2. Please use the module mpl_finance instead. warnings.warn(message, mplDeprecation, stacklevel=1)

I of course tried replacing the line

from matplotlib.finance import candlestick_ohlc

with

from mpl_finance import candlestick_ohlc

but it still doesn't work. Anyone know how to run the code? Thanks.


Solution

  • DeprecationWarnings are generally only advisory warnings. You should still be able to use the imported function (candlestick_ohlc in this case) and execute the rest of the code after it.

    As far as why the mpl_finance import doesn't work -- did you install mpl_finance? It appears to be at https://github.com/matplotlib/mpl_finance .