Skip to content

AttributeError: type object 'NDFrame' has no attribute 'groupby' #133

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
gfranco008 opened this issue Sep 22, 2020 · 6 comments
Open

AttributeError: type object 'NDFrame' has no attribute 'groupby' #133

gfranco008 opened this issue Sep 22, 2020 · 6 comments

Comments

@gfranco008
Copy link

AttributeError: type object 'NDFrame' has no attribute 'groupby'

from pandas_ml import ConfusionMatrix
cm = ConfusionMatrix(actu, pred)
cm.print_stats()


AttributeError Traceback (most recent call last)
in
----> 1 from pandas_ml import confusion_matrix
2
3 cm = ConfusionMatrix(actu, pred)
4 cm.print_stats()

/usr/local/lib/python3.8/site-packages/pandas_ml/init.py in
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

/usr/local/lib/python3.8/site-packages/pandas_ml/core/init.py in
1 #!/usr/bin/env python
2
----> 3 from pandas_ml.core.frame import ModelFrame # noqa
4 from pandas_ml.core.series import ModelSeries # noqa

/usr/local/lib/python3.8/site-packages/pandas_ml/core/frame.py in
16 from pandas_ml.core.accessor import _AccessorMethods
17 from pandas_ml.core.generic import ModelPredictor, _shared_docs
---> 18 from pandas_ml.core.series import ModelSeries
19
20

/usr/local/lib/python3.8/site-packages/pandas_ml/core/series.py in
9
10
---> 11 class ModelSeries(ModelTransformer, pd.Series):
12 """
13 Wrapper for pandas.Series to support sklearn.preprocessing

/usr/local/lib/python3.8/site-packages/pandas_ml/core/series.py in ModelSeries()
78 return df
79
---> 80 @appender(pd.core.generic.NDFrame.groupby.doc)
81 def groupby(self, by=None, axis=0, level=None, as_index=True, sort=True,
82 group_keys=True, squeeze=False):

AttributeError: type object 'NDFrame' has no attribute 'groupby'

@joakimzhang
Copy link

any resolution?I also find this error

@Wenzkal
Copy link

Wenzkal commented Dec 10, 2020

I have the same problem as mentioned above

AttributeError: type object 'NDFrame' has no attribute 'groupby'.

Anyone facing this and have resolution...I am still trying

@alexjulien
Copy link

Same here, from the first
import pandas_ml as pdml
in a fresh pipenv with only pandas and pandas-ml

@elcolie
Copy link

elcolie commented Dec 24, 2020

Workaround. I put constraint like this and run with python3.7

pandas==0.24.2
pandas-ml
scikit-learn==0.20.0

@rtbs-dev
Copy link

rtbs-dev commented Sep 8, 2021

This could be relevant: PR to remove (redundant?) NDFrameGroupBy. I don't thing the NDFrameGroupBy was intended as a generic interface that covered both the dataframe and series versions... the NDFrame definition does not implement a groupby method (though I weirdly see it being accessed here.

Seems like pandas-ml may want to use a different argument to the append decorator here. Based on digging through the style for DataFrame.groupby() and Series.groupby(), it seems the pandas devs already have a global _shared_docs object to use with their Appender decorator, so we should probably access this groupby docstring?

If that's an easy fix, whipping up a PR shouldn't be too bad. But I'd want to hear what @sinhrks has to say about it... any particular reason not to use the pandas.core._shared_docs variable in your Appender calls? Also might want to ask @WillAyd, since they seem to have deprecated this usage and I don't see it in the pandas v0.25 or v1.0.0 changelog? I'm just shooting in the dark here though. 🤷

@johnperry-math
Copy link

johnperry-math commented Jul 22, 2024

4 years later, this issue is still affecting at least some of us.

Fresh install of pandas_ml for Python 3.12.4.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

7 participants