【问题标题】:Where is pandas.tools?pandas.tools 在哪里
【发布时间】:2019-06-25 15:33:20
【问题描述】:

安装后pandas:

idf:~/Documents/python/plot$ pip3 install pandas --user
Collecting pandas
  Using cached https://files.pythonhosted.org/packages/f9/e1/4a63ed31e1b1362d40ce845a5735c717a959bda992669468dae3420af2cd/pandas-0.24.0-cp36-cp36m-manylinux1_x86_64.whl
Requirement already satisfied: numpy>=1.12.0 in /home/idf/.local/lib/python3.6/site-packages (from pandas) (1.15.4)
Requirement already satisfied: pytz>=2011k in /home/idf/.local/lib/python3.6/site-packages (from pandas) (2018.7)
Requirement already satisfied: python-dateutil>=2.5.0 in /home/idf/.local/lib/python3.6/site-packages (from pandas) (2.7.5)
Requirement already satisfied: six>=1.5 in /home/idf/.local/lib/python3.6/site-packages (from python-dateutil>=2.5.0->pandas) (1.12.0)
zipline 1.3.0 has requirement pandas<=0.22,>=0.18.1, but you'll have pandas 0.24.0 which is incompatible.
Installing collected packages: pandas
Successfully installed pandas-0.24.0
idf:~/Documents/python/plot$ 

我尝试加载pandas.tools

from pandas.tools.plotting import autocorrelation_plot

ModuleNotFoundError                       Traceback (most recent call last)
<ipython-input-52-e11ce94b8d5d> in <module>
----> 1 from pandas.tools.plotting import autocorrelation_plot


ModuleNotFoundError: No module named 'pandas.tools'

如何访问pandas.tools

【问题讨论】:

标签: python-3.x pandas


【解决方案1】:

变成了pandas.plotting

希望这会有所帮助。

【讨论】:

    【解决方案2】:
    Traceback (most recent call last):
      File "brod.py", line 3, in <module>
        from pandas.tools.plotting import scatter_matrix
    ModuleNotFoundError: No module named 'pandas.tools'
    

    这发生在新版本的 pandas 中。这个

    from pandas.tools.plotting import scatter_matrix
    

    适用于旧版 pandas,如果您使用新版 pandas 然后编写代码

    from pandas.plotting import scatter_matrix
    

    而不是

    from pandas.tools.plotting import scatter_matrix
    

    【讨论】:

      【解决方案3】:

      使用 pandas.plotting 而不是 pandas.tools.plotting 谢谢

      【讨论】:

        【解决方案4】:

        pandas.tools.plotting 已移至 this commit 中的 pandas.plotting,作为 Pandas 0.20.0#16005#12548 的一部分。

        最近,在 Pandas 中的 this commit #23376 在 Pandas 0.24.0 中发布的 pandas.tools 包(之前允许 pandas.tools.plotting 继续工作)已被删除。

        所以,一旦您允许 Pandas 升级到 0.24.0 或更高版本,您需要将来自 pandas.tools.plotting 的导入替换为来自 pandas.plotting 的导入。

        【讨论】:

          猜你喜欢
          • 2012-07-25
          • 1970-01-01
          • 1970-01-01
          • 2010-09-21
          • 2012-10-05
          • 1970-01-01
          • 1970-01-01
          • 1970-01-01
          • 2021-05-28
          相关资源
          最近更新 更多