How to fix mpl_finance package for MatPlotLib?

我是研究僧i 提交于 2019-12-18 06:57:25

问题


Getting this error message:

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.

How do I put in place the mpl_finance package instead. I have it installed in pip, but what is the proper import phraseology?

import datetime as dt
import matplotlib.pyplot as plt
from matplotlib import style
from matplotlib.finance import candlestick_ohlc
import matplotlib.dates as mdates
import pandas as pd
import pandas_datareader.data as web
from googlefinance import getQuotes
import json
from datetime import datetime
from forex_python.converter import CurrencyRates
from yahoo_finance import Share

回答1:


All code for matplotlib.finance moved to a separate repository. Here is an example of usage. To answer your question:

from mpl_finance import candlestick_ohlc



回答2:


To import a module which is installed through pip with the name x you would mostly want to do import x.

So, here

import mpl_finance

or to get one of its functions, e.g.

from mpl_finance import candlestick_ohlc


来源:https://stackoverflow.com/questions/44700715/how-to-fix-mpl-finance-package-for-matplotlib

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!