- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
from pyfinance.ols import PandasRollingOLS
我收到以下错误:
Traceback (most recent call last):
File "/usr/local/lib/python3.8/site-packages/pyfinance/utils.py", line 78, in <module>
from pandas.tseries.frequencies import FreqGroup, get_freq_code
ImportError: cannot import name 'FreqGroup' from 'pandas.tseries.frequencies' (/usr/local/lib/python3.8/site-packages/pandas/tseries/frequencies.py)
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "<string>", line 1, in <module>
File "/usr/local/lib/python3.8/site-packages/pyfinance/__init__.py", line 32, in <module>
from .returns import TFrame, TSeries # noqa
File "/usr/local/lib/python3.8/site-packages/pyfinance/returns.py", line 42, in <module>
from pyfinance import ols, utils
File "/usr/local/lib/python3.8/site-packages/pyfinance/ols.py", line 15, in <module>
from pyfinance import utils
File "/usr/local/lib/python3.8/site-packages/pyfinance/utils.py", line 80, in <module>
from pandas._libs.tslibs.frequencies import FreqGroup, get_freq_code
ModuleNotFoundError: No module named 'pandas._libs.tslibs.frequencies'
我尝试卸载并重新安装 Pandas 版本 1.1.3、1.1.2、1.1.1,但它们都不起作用,我只是遇到相同的错误,然后我尝试以以下方式构建 Pandas:
!python setup.py build_ext --inplace --force
我仍然得到同样的错误
最佳答案
仅供引用
我做了一些挖掘,看起来 Pandas 改变了他们的 api,这导致了提到的错误。我修改了源代码并包含在 pyfinance/utils.py
中的正确导入:
在第 77 行更改为:
try:
from pandas.tseries.frequencies import FreqGroup, get_freq_code
except ImportError: # 0.24+, or somewhere around then
from pandas._libs.tslibs.frequencies import FreqGroup, get_freq_code
到
try:
from pandas.tseries.frequencies import FreqGroup, get_freq_code
except ImportError:
from pandas._libs.tslibs.dtypes import FreqGroup
from pandas.tests.tslibs.test_period_asfreq import get_freq_code
我创建了一个拉取请求
here如果您遇到同样的问题,您可以克隆并安装我的
fork
关于python - ModuleNotFoundError : No module named 'pandas._libs.tslibs.frequencies' ,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/64497720/
我无法导入 Pandas C:\Users\Yash\Desktop\Python\Twitter Sentimental Analysis>python import.py Traceback (
我已经浪费了几个小时试图解决这个问题,所以我想是时候问问某人/某人了。 我(认为)我已经卸载了与 python 相关的所有内容然后再次安装。我刚安装 python最新版本和使用过的 pip安装 pan
我想将此时间戳对象转换为日期时间此对象是在数据帧上使用 asfreq 后获得的这是最后一个索引 Timestamp('2018-12-01 00:00:00', freq='MS') 想要的输出 2
我发现了几个关于同一问题的问题 here和 here from pyfinance.ols import PandasRollingOLS 我收到以下错误: Traceback (most recen
我正在使用 pythonanywere.com 来部署我的 Django 应用程序。所以我在那个虚拟环境中安装了一些机器学习库。 (venv) 19:16 ~ $ pip3 list Package
我正在尝试从 Analytics Vidhya 做贷款预测的机器学习练习题。当我使用随机森林分类器时,它显示: TypeError:float() argument must be a string
我是 Python 的新手,正在使用 Windows 10 上的 Anaconda 来学习如何实现机器学习。在 Spyder 上运行这段代码: import sklearn as skl 最初给我的是
我正在尝试将情绪从一个数据集映射到另一个数据集,并删除当前数据集中大于 6 的所有内容。我应该如何修复此错误? import pandas as pd csv_file = 'sample.csv'
我正在尝试使用 Windows 的 PyInstaller(开发版)将 Python 脚本包装到 exe 中。 脚本使用 Pandas,我在运行 exe 时遇到了错误。 Traceback (most
我在 Spyder 4.2.1 上使用 pandas 包时遇到问题。 目前使用: MacOS Big Sur ver. 11.2 Python 3.9 Spyder 4.2.1 python 2020
每当我尝试导入 pandas 时,无论是在 virtualenv 中还是其他地方,我总是会收到此错误。 Python 3.6.2 |Anaconda custom (64-bit)| (default
然后我想将 --system-site-packages 参数与 virtualenvwrapper 一起使用。但是我有一个 SSL 错误: $ mkvirtualenv --system-site-
我是 Python 的学习者。执行我的脚本时出现问题。Pyinstaller 打包时显示 failed to execute script due to ModuleNotFoundError: No
在我尝试导入 cuml 库之前,我已经在 Colab 中安装了 RAPIDS,没有任何问题。 幸运的是,我有 Tesla 4 作为 GPU。 这就是我安装 RAPIDS 的方式 # clone RAP
我有一个 pandas 'Time' 列,其值格式为 4/7/2013字符串类型。我正在尝试将整个列转换为 datetime.datetime 格式。我使用了以下代码- df3['Date'] =
我正在尝试编译我们的代码 https://bitbucket.org/OES_muni/massiveoes从 python 2.7 升级到 3.6 并同时移动到 scipy 1.0.0 后使用 py
当我用 php bin/magento setup:static-content:deploy 编译静态时,我收到以下错误: Unable to get content for 'frontend/M
我为卷积神经网络创建了一个 tkinter 应用程序来识别图像。我正在尝试使用 pyinstaller 编译 py 文件,但收到此错误: AttributeError:类型对象“pandas._lib
我在训练 LR 模型时使用 sklearn2pmml.preprocessing.CutTransformer 和 sklearn.preprocessing.LabelEncoder 对目标进行编码
早上好,我已经使用 python 大约一年半了,我发现自己面临着一个我无法解决的基本问题。 我有一个简单的数据框 (df),不大(大约 12k 行和 10 列),其中包括一列是“datetime64[
我是一名优秀的程序员,十分优秀!