File tree Expand file tree Collapse file tree 1 file changed +5
-3
lines changed Expand file tree Collapse file tree 1 file changed +5
-3
lines changed Original file line number Diff line number Diff line change @@ -6311,16 +6311,18 @@ def fillna(
6311
6311
value_map = create_series_with_explicit_dtype (
6312
6312
value , dtype_if_empty = object
6313
6313
)
6314
- if self .dtype == "object" :
6314
+ # GH#40498 objects can have multiple types of missing values which should not be modified unless
6315
+ # specified. Add special casing to minimize performance decrease on other data types where this is
6316
+ # not required.
6317
+ if is_object_dtype (self .dtype ):
6315
6318
value = self .copy ()
6316
6319
modification_index = value .index .intersection (value_map .index )
6317
6320
if not modification_index .empty :
6318
6321
value .loc [modification_index ] = value_map [
6319
6322
modification_index
6320
6323
]
6321
6324
else :
6322
- value = value_map
6323
- value = value .reindex (self .index , copy = False )
6325
+ value = value_map .reindex (self .index , copy = False )
6324
6326
value = value ._values
6325
6327
elif not is_list_like (value ):
6326
6328
pass
You can’t perform that action at this time.
0 commit comments