@@ -1393,12 +1393,21 @@ def nth(self, n, dropna=None):
1393
1393
1394
1394
return out .sort_index () if self .sort else out
1395
1395
1396
- if isinstance (self ._selected_obj , DataFrame ) and \
1397
- dropna not in ['any' , 'all' ]:
1398
- # Note: when agg-ing picker doesn't raise this, just returns NaN
1399
- raise ValueError ("For a DataFrame groupby, dropna must be "
1400
- "either None, 'any' or 'all', "
1401
- "(was passed %s)." % (dropna ),)
1396
+ if dropna not in ['any' , 'all' ]:
1397
+ if isinstance (self ._selected_obj , Series ) and dropna is True :
1398
+ warnings .warn ("the dropna='%s' keyword is deprecated,"
1399
+ "use dropna='all' instead. "
1400
+ "For a Series groupby, dropna must be "
1401
+ "either None, 'any' or 'all'." % (dropna ),
1402
+ FutureWarning ,
1403
+ stacklevel = 2 )
1404
+ dropna = 'all'
1405
+ else :
1406
+ # Note: when agg-ing picker doesn't raise this,
1407
+ # just returns NaN
1408
+ raise ValueError ("For a DataFrame groupby, dropna must be "
1409
+ "either None, 'any' or 'all', "
1410
+ "(was passed %s)." % (dropna ),)
1402
1411
1403
1412
# old behaviour, but with all and any support for DataFrames.
1404
1413
# modified in GH 7559 to have better perf
0 commit comments