Replacing bad data with Pandas


Suppose you are given a dataframe, df, that contains various negative values. In the context of your work, negative values can be considered 'bad data'. Write a function in Python (using Pandas) that replaces these bad values with the group mean.


Access restricted

Subscribe to premium account to see the solution.

Get premium now