gpt4 book ai didi

python-3.x - pandas_ml 坏了吗?

转载 作者:行者123 更新时间:2023-12-03 16:21:21 30 4
gpt4 key购买 nike

版本信息和问题如下。我想知道 pandas_ml 是坏了还是我做错了什么。为什么我无法导入 pandas_ml?

基础信息:
sklearn 和 pandas_ml 和 python 的版本如下:

Python                            3.8.2
scikit-learn 0.23.0
pandas-ml 0.6.1

问题:
import pandas_ml as pdml

返回以下错误:
---------------------------------------------------------------------------
AttributeError Traceback (most recent call last)
<ipython-input-47-79d5f9d2381c> in <module>
----> 1 import pandas_ml as pdml
2 #from pandas_ml import ModelFrame
3 #mf = pdml.ModelFrame(df.to_dict())
4 #mf.head()

d:\program files\python38\lib\site-packages\pandas_ml\__init__.py in <module>
1 #!/usr/bin/env python
2
----> 3 from pandas_ml.core import ModelFrame, ModelSeries # noqa
4 from pandas_ml.tools import info # noqa
5 from pandas_ml.version import version as __version__ # noqa

d:\program files\python38\lib\site-packages\pandas_ml\core\__init__.py in <module>
1 #!/usr/bin/env python
2
----> 3 from pandas_ml.core.frame import ModelFrame # noqa
4 from pandas_ml.core.series import ModelSeries # noqa

d:\program files\python38\lib\site-packages\pandas_ml\core\frame.py in <module>
8
9 import pandas_ml.imbaccessors as imbaccessors
---> 10 import pandas_ml.skaccessors as skaccessors
11 import pandas_ml.smaccessors as smaccessors
12 import pandas_ml.snsaccessors as snsaccessors

d:\program files\python38\lib\site-packages\pandas_ml\skaccessors\__init__.py in <module>
13 from pandas_ml.skaccessors.linear_model import LinearModelMethods # noqa
14 from pandas_ml.skaccessors.manifold import ManifoldMethods # noqa
---> 15 from pandas_ml.skaccessors.metrics import MetricsMethods # noqa
16 from pandas_ml.skaccessors.model_selection import ModelSelectionMethods # noqa
17 from pandas_ml.skaccessors.neighbors import NeighborsMethods # noqa

d:\program files\python38\lib\site-packages\pandas_ml\skaccessors\metrics.py in <module>
254 _true_pred_methods = (_classification_methods + _regression_methods
255 + _cluster_methods)
--> 256 _attach_methods(MetricsMethods, _wrap_target_pred_func, _true_pred_methods)
257
258

d:\program files\python38\lib\site-packages\pandas_ml\core\accessor.py in _attach_methods(cls, wrap_func, methods)
91
92 for method in methods:
---> 93 _f = getattr(module, method)
94 if hasattr(cls, method):
95 raise ValueError("{0} already has '{1}' method".format(cls, method))

AttributeError: module 'sklearn.metrics' has no attribute 'jaccard_similarity_score'

最佳答案

看来确实如此。这是情况:

虽然函数jaccard_similarity_score未显示在 sklearn.metrics 的可用版本中在 documentation ,除了 source code 之外,它仍然在引擎盖下(因此可用)直到 v0.22.2( jaccard_score )一。但是在latest v0.23的源代码中,已被删除,只有 jaccard_score遗迹。

这意味着仍然可以通过简单地将 scikit-learn 降级到 v.0.22.2 来使用 pandas-ml。但不幸的是,这也不起作用,抛出一个不同的错误:

!pip install pandas-ml
# Successfully installed enum34-1.1.10 pandas-ml-0.6.1

import sklearn
sklearn.__version__
# '0.22.2.post1'

import pandas_ml as pdml

[...]

AttributeError: module 'sklearn.preprocessing' has no attribute 'Imputer'

我想可以通过回溯足够多的时间来找到一个适用于它的 scikit-learn 版本(他们 Github repo 中的最后一次提交是在 2019 年 3 月),但不确定是否值得大惊小怪。无论如何,他们甚至没有在他们的 requirements file 中提到 scikit-learn(更不用说它的任何特定版本)。 ,这似乎不是很好的做法,整个项目似乎都被放弃了。

关于python-3.x - pandas_ml 坏了吗?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/61819628/

30 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com