Fernando Chu
Fernando Chu

Reputation: 383

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.

Upvotes: 2

Views: 2737

Answers (2)

Daniel Goldfarb
Daniel Goldfarb

Reputation: 7714

There is a new version of matplotlib finance, with documentation, here:

https://pypi.org/project/mplfinance/

Install with: pip install --upgrade mplfinance

NOTE: The package name no longer has the dash or underscore: It is now mplfinance (not mpl-finance, nor mpl_finance)

Upvotes: 1

Michael Nelson
Michael Nelson

Reputation: 340

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 .

Upvotes: 0

Related Questions