Skip to content

DEPR: inplace in DataFrameGroupBy.fillna and SeriesGroupBy.fillna #48792

Closed
@rhshadrach

Description

@rhshadrach

Specifying inplace returns an empty frame or a Series with all None values, and neither modifies the original input. Instead of fixing this, I think we should deprecate the inplace argument of these methods.

df = pd.DataFrame({'a': [1, 1, 2], 'b': [np.nan, 3, np.nan]})
gb = df.groupby('a')

print(gb.fillna(0, inplace=True))
# Empty DataFrame
# Columns: []
# Index: []

print(gb['b'].fillna(0, inplace=True))
# a
# 1    None
# 2    None
# Name: b, dtype: object

print(df)
#    a    b
# 0  1  NaN
# 1  1  3.0
# 2  2  NaN

Metadata

Metadata

Assignees

No one assigned

    Labels

    DeprecateFunctionality to remove in pandasGroupbyMissing-datanp.nan, pd.NaT, pd.NA, dropna, isnull, interpolate

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions