Skip to content

Cannot access callable attribute 'groupby' of 'DataFrameGroupBy' objects #20317

@ymhiri

Description

@ymhiri

Hello,

I'm newbie in Panda. I want to groupby my dataframe poll_df by Start Date. I get this error. How can I fix it?

Thanks for your help

Code Sample, a copy-pastable example if possible

poll_df = poll_df.groupby(['Start Date'],as_index=False)

Problem description


AttributeError Traceback (most recent call last)
in ()
----> 1 poll_df = poll_df.groupby(['Start Date'])
2 poll_df.head()

C:\ProgramData\Anaconda2\lib\site-packages\pandas\core\groupby.pyc in getattr(self, attr)
671 return self[attr]
672 if hasattr(self.obj, attr):
--> 673 return self._make_wrapper(attr)
674
675 raise AttributeError("%r object has no attribute %r" %

C:\ProgramData\Anaconda2\lib\site-packages\pandas\core\groupby.pyc in _make_wrapper(self, name)
685 "using the 'apply' method".format(kind, name,
686 type(self).name))
--> 687 raise AttributeError(msg)
688
689 # need to setup the selection

AttributeError: Cannot access callable attribute 'groupby' of 'DataFrameGroupBy' objects, try using the 'apply' method

Expected Output

Output of pd.show_versions()

INSTALLED VERSIONS

commit: None
python: 2.7.14.final.0
python-bits: 64
OS: Windows

pandas: 0.22.0
pytest: 3.3.2
pip: 9.0.1
setuptools: 38.4.0
Cython: 0.27.3
numpy: 1.14.0
scipy: 1.0.0
pyarrow: None
xarray: None
IPython: 5.4.1
sphinx: 1.6.6
patsy: 0.5.0
dateutil: 2.6.1
pytz: 2017.3
blosc: None
bottleneck: 1.2.1
tables: 3.4.2
numexpr: 2.6.4
feather: None
matplotlib: 2.1.2
openpyxl: 2.4.10
xlrd: 1.1.0
xlwt: 1.3.0
xlsxwriter: 1.0.2
lxml: 4.1.1
bs4: 4.6.0
html5lib: 1.0.1
sqlalchemy: 1.2.1
pymysql: None
psycopg2: None
jinja2: 2.10
s3fs: None
fastparquet: None
pandas_gbq: None
pandas_datareader: 0.6.0

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions