@@ -2252,7 +2252,7 @@ def convert_objects(self, convert_dates=True, convert_numeric=False,
2252
2252
#----------------------------------------------------------------------
2253
2253
# Filling NA's
2254
2254
2255
- def fillna (self , value = None , method = None , axis = 0 , inplace = False ,
2255
+ def fillna (self , value = None , method = None , axis = None , inplace = False ,
2256
2256
limit = None , downcast = None ):
2257
2257
"""
2258
2258
Fill NA/NaN values using the specified method
@@ -2295,6 +2295,10 @@ def fillna(self, value=None, method=None, axis=0, inplace=False,
2295
2295
'you passed a "{0}"' .format (type (value ).__name__ ))
2296
2296
self ._consolidate_inplace ()
2297
2297
2298
+ # set the default here, so functions examining the signaure
2299
+ # can detect if something was set (e.g. in groupby) (GH9221)
2300
+ if axis is None :
2301
+ axis = 0
2298
2302
axis = self ._get_axis_number (axis )
2299
2303
method = com ._clean_fill_method (method )
2300
2304
@@ -2383,12 +2387,12 @@ def fillna(self, value=None, method=None, axis=0, inplace=False,
2383
2387
else :
2384
2388
return self ._constructor (new_data ).__finalize__ (self )
2385
2389
2386
- def ffill (self , axis = 0 , inplace = False , limit = None , downcast = None ):
2390
+ def ffill (self , axis = None , inplace = False , limit = None , downcast = None ):
2387
2391
"Synonym for NDFrame.fillna(method='ffill')"
2388
2392
return self .fillna (method = 'ffill' , axis = axis , inplace = inplace ,
2389
2393
limit = limit , downcast = downcast )
2390
2394
2391
- def bfill (self , axis = 0 , inplace = False , limit = None , downcast = None ):
2395
+ def bfill (self , axis = None , inplace = False , limit = None , downcast = None ):
2392
2396
"Synonym for NDFrame.fillna(method='bfill')"
2393
2397
return self .fillna (method = 'bfill' , axis = axis , inplace = inplace ,
2394
2398
limit = limit , downcast = downcast )
0 commit comments