ImportError: cannot import name 'DictType' from 'types'

ImportError: cannot import name 'DictType' from 'types'

import pandas as pd
import pandapower as pp
import control
import timeseries
import inspect

我在使用 Spyder IDE 的 Anaconda 上收到 Timeseries 包的错误。我是 运行 Python 版本 3.7.4 和 Anaconda 4.7.12。

看了timeseriespypi entry and github repo,好像只有一个正式版。

您看到的错误源自 this file,您应该能够通过删除导入语句(第 1 行)并将第 26 行替换为

来修复它
if isinstance(points, dict):

您可以通过实际更改存储在本地的文件来在本地进行此更改 - 模块的文件夹应位于 {folder your python3.7 is installed in}/lib/site-packages.../lib/python3.7 中,具体取决于您使用的操作系统。如果此修复有效,您可以考虑向包含更改的原始 git 存储库提交拉取请求。


但是,考虑到模块的年龄和明显缺乏支持,您可能会考虑使用不同的模块进行时间序列数据分析。 A quick google search 表明 matplotlibnumpyscipyscikit-learnpandas 都是信誉良好、支持良好的包,对处理很有用时间序列数据,如果你在制作任何你正在制作的东西时遇到问题,你更有可能在使用这些更流行的工具时找到有效的帮助。