【问题标题】:How to fix mpl_finance package for MatPlotLib?如何修复 MatPlotLib 的 mpl_finance 包?
【发布时间】:2017-06-22 13:24:49
【问题描述】:

收到此错误消息:

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.

我该如何放置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

【问题讨论】:

    标签: python pandas matplotlib google-finance


    【解决方案1】:

    matplotlib.finance 的所有代码都移到了separate repository。这是example of usage. 回答您的问题:

    from mpl_finance import candlestick_ohlc
    

    【讨论】:

    • 正是我需要的。谢谢你。斯帕西博!
    【解决方案2】:

    要导入一个通过 pip 安装的名为 x 的模块,您最想做的是 import x

    所以,这里

    import mpl_finance
    

    或获取其功能之一,例如

    from mpl_finance import candlestick_ohlc
    

    【讨论】:

      【解决方案3】:

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

      【讨论】:

        猜你喜欢
        • 1970-01-01
        • 1970-01-01
        • 2017-09-29
        • 1970-01-01
        • 2020-07-21
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 2023-01-08
        相关资源
        最近更新 更多