File tree 2 files changed +6
-2
lines changed
2 files changed +6
-2
lines changed Original file line number Diff line number Diff line change @@ -493,7 +493,12 @@ def _format_duplicate_message(self):
493
493
duplicates = self [self .duplicated (keep = "first" )].unique ()
494
494
assert len (duplicates )
495
495
496
- out = Series (np .arange (len (self ))).groupby (self ).agg (list )[duplicates ]
496
+ # see pr-35967 about the observed keyword
497
+ out = (
498
+ Series (np .arange (len (self )))
499
+ .groupby (self , observed = False )
500
+ .agg (list )[duplicates ]
501
+ )
497
502
if self .nlevels == 1 :
498
503
out = out .rename_axis ("label" )
499
504
return out .to_frame (name = "positions" )
Original file line number Diff line number Diff line change @@ -384,7 +384,6 @@ def test_merge_raises(self):
384
384
],
385
385
ids = lambda x : type (x ).__name__ ,
386
386
)
387
- @pytest .mark .filterwarnings ("ignore:Using 'observed:FutureWarning" )
388
387
def test_raises_basic (idx ):
389
388
msg = "Index has duplicates."
390
389
with pytest .raises (pd .errors .DuplicateLabelError , match = msg ):
You can’t perform that action at this time.
0 commit comments