Skip to content

BUG: Grouper should have a dropna attribute #36620

Closed
@arw2019

Description

@arw2019
  • I have checked that this issue has not already been reported.

  • I have confirmed this bug exists on the latest version of pandas.

  • (optional) I have confirmed this bug exists on the master branch of pandas.


xref #35612

Code Sample, a copy-pastable example

In [1]: import pandas as pd 
   ...: df = pd.DataFrame({"A": [0, 0, 1, None], "B": [10, 2, 10, None]}) 
   ...: gb = df.groupby('A', dropna=False)                                     

In [2]: gb.dropna                                                              
Out[2]: False

In [3]: gb.grouper.dropna                                                      
---------------------------------------------------------------------------
AttributeError                            Traceback (most recent call last)
<ipython-input-3-4d8081f9c78e> in <module>
----> 1 gb.grouper.dropna

AttributeError: 'BaseGrouper' object has no attribute 'dropna'

Problem description

Now that we support a dropna argument to DataFrameGroupBy and SeriesGroupBy we need to be able to use it in Grouper (#35751)

Output of pd.show_versions()

INSTALLED VERSIONS

commit : f34a56b
python : 3.7.7.final.0
python-bits : 64
OS : Linux
OS-release : 5.4.0-48-generic
Version : #52-Ubuntu SMP Thu Sep 10 10:58:49 UTC 2020
machine : x86_64
processor :
byteorder : little
LC_ALL : C.UTF-8
LANG : C.UTF-8
LOCALE : en_US.UTF-8

pandas : 1.2.0.dev0+484.gf34a56b4d
numpy : 1.18.5
pytz : 2020.1
dateutil : 2.8.1
pip : 20.1.1
setuptools : 45.2.0.post20200210
Cython : 0.29.21
pytest : 5.4.3
hypothesis : 5.19.0
sphinx : 3.1.1
blosc : None
feather : None
xlsxwriter : 1.2.9
lxml.etree : 4.4.1
html5lib : 1.1
pymysql : None
psycopg2 : None
jinja2 : 2.11.2
IPython : 7.16.1
pandas_datareader: None
bs4 : 4.9.1
bottleneck : 1.3.2
fsspec : 0.7.4
fastparquet : 0.4.0
gcsfs : 0.6.2
matplotlib : 3.2.1
numexpr : 2.7.1
odfpy : None
openpyxl : 3.0.4
pandas_gbq : None
pyarrow : 0.16.0
pytables : None
pyxlsb : None
s3fs : 0.4.2
scipy : 1.5.0
sqlalchemy : 1.3.18
tables : 3.6.1
tabulate : 0.8.7
xarray : 0.15.1
xlrd : 1.2.0
xlwt : 1.3.0
numba : 0.50.1

Metadata

Metadata

Assignees

No one assigned

    Labels

    BugNeeds TriageIssue that has not been reviewed by a pandas team member

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions