Skip to content

BUG: Series.fillna is altering None values of unspecified columns #40498

Open
@RSchweiger

Description

@RSchweiger
  • I have checked that this issue has not already been reported.
  • I have confirmed this bug exists on the latest version of pandas (1.0.5)

series = pd.Series({'1':1,'2':None,'3':np.nan, '4':''})

will create a series which looks like:

1       1
2    None
3     NaN
4        
dtype: object

When using the fillna method on this series on index 3 it changes also the entry in index 2!

series.fillna({'3':0})

This will result in a output as follows:

1      1
2    NaN
3      0
4       
dtype: object

Problem:
The value at index 2 changed from None to NaN.

Expected Behaviour:
The value at index 2 should never be touched when using fillna and specifying the indices you want to alter.

Metadata

Metadata

Assignees

No one assigned

    Labels

    BugMissing-datanp.nan, pd.NaT, pd.NA, dropna, isnull, interpolateSeriesSeries data structure

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions