Skip to content

Commit fb69376

Browse files
committed
BUG: Include "dropna" in Grouper._attributes
All this changes I think is that now `dropna` is included in the `__repr__` output. See #46258 for more discussion. And move dropna up out of the "generated" attribute section into the "source" attribute section in the __init__
1 parent df1d155 commit fb69376

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed

doc/source/whatsnew/v1.4.3.rst

+1-1
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ Fixed regressions
2424

2525
Bug fixes
2626
~~~~~~~~~
27-
-
27+
- Include ``dropna`` in ``__repr__`` of a :class:`Grouper` (:issue:`46754`)
2828
-
2929

3030
.. ---------------------------------------------------------------------------

pandas/core/groupby/grouper.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -263,7 +263,7 @@ class Grouper:
263263
_gpr_index: Index | None
264264
_grouper: Index | None
265265

266-
_attributes: tuple[str, ...] = ("key", "level", "freq", "axis", "sort")
266+
_attributes: tuple[str, ...] = ("key", "level", "freq", "axis", "sort", "dropna")
267267

268268
def __new__(cls, *args, **kwargs):
269269
if kwargs.get("freq") is not None:
@@ -287,6 +287,7 @@ def __init__(
287287
self.freq = freq
288288
self.axis = axis
289289
self.sort = sort
290+
self.dropna = dropna
290291

291292
self.grouper = None
292293
self._gpr_index = None
@@ -295,7 +296,6 @@ def __init__(
295296
self.binner = None
296297
self._grouper = None
297298
self._indexer = None
298-
self.dropna = dropna
299299

300300
@final
301301
@property

0 commit comments

Comments
 (0)