AttributeError: 导入Dask时,模块’pandas.core.strings’没有’StringMethods’属性。

huangapple go评论102阅读模式
英文:

AttributeError: module 'pandas.core.strings' has no attribute 'StringMethods' when importing Dask

问题

我在尝试导入dask.dataframe接口时,即使import dask可以工作,仍然出现了问题标题中所述的错误。

我的当前版本是2022.7.0。可能的问题是什么?

英文:

I am getting the error stated in the question title when trying to import dask.dataframe interface, even though import dask works.

My current version of dask is 2022.7.0. What might be the problem?

答案1

得分: 9

问题出在Pandas和Dask之间的版本兼容性问题上。StringMethods 是Pandas的字符串处理功能的一部分,Dask DataFrames 也使用它。

然而,我不知道这个属性在较旧版本的Pandas中不可用。

我更新了这两个库,错误消失了:

pip install --upgrade pandas "dask[complete]"
英文:

As it turns out, the problem was with version compatibility issues between Pandas and Dask. StringMethods is a part of Pandas' string handling functionality, which is used by Dask DataFrames.

However, I didn't know that this attribute was not available in older versions of Pandas.

I updated both libraries and the error was gone:

pip install --upgrade pandas "dask[complete]"

huangapple
  • 本文由 发表于 2023年5月24日 19:09:16
  • 转载请务必保留本文链接:https://go.coder-hub.com/76322899.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定