pandas 如何修复 MatPlotLib 的 mpl_finance 包?

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/44700715/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-14 03:51:27  来源:igfitidea点击:

How to fix mpl_finance package for MatPlotLib?

pythonpandasmatplotlibgoogle-finance

提问by sgerbhctim

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.

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_financepackage instead. I have it installed in pip, but what is the proper import phraseology?

我该如何放置mpl_finance包裹。我已将其安装在 pip 中,但正确的导入用语是什么?

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

回答by omdv

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

matplotlib.finance 的所有代码都移到了单独的存储库中。这是一个使用示例。回答你的问题:

from mpl_finance import candlestick_ohlc

回答by ImportanceOfBeingErnest

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

要导入通过 pip 安装的模块,其名称是x您最想要的import x

So, here

所以在这里

import mpl_finance

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

或获得其功能之一,例如

from mpl_finance import candlestick_ohlc

回答by Daniel Goldfarb

new version can be found here: https://pypi.org/project/mplfinance/

新版本可以在这里找到:https: //pypi.org/project/mplfinance/