Skip to content

Mode() not compatible with fillna() #9750

Closed
@alfonsomhc

Description

@alfonsomhc

I made an toy dataframe:
df = pandas.DataFrame([[1, 1, 1],[2, 1, 1],[2, 1, 1],[numpy.nan, numpy.nan, numpy.nan]], columns=["a","b","c"])

I try different methods to fill missing values. These work as expected:
df.fillna(df.mean())
df.fillna(df.median())

But this doesnt work:
df.fillna(df.mode())

Inspecting the output from df.mode() I see it has different format than df.mean() and df.median(). As I user I would expect the same behavior for these functions, and be able to fill missing values as described.
Using Pandas 0.15.2

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions