nabzzzz
nabzzzz

Reputation: 21

Does the mean method in pandas include nan in its calculation?

I have a big dataframe with large number of nan cells. Does the mean function include nan cells in its calculation in python?

Upvotes: 1

Views: 196

Answers (1)

Wolfgang
Wolfgang

Reputation: 1398

You can add skipna=True or skipna=False

DataFrame.mean( axis=None, 
                skipna=True, # If you set skipna to True it will skip NaN
                level=None, 
                numeric_only=None, 
                **kwargs)

skipna Boolean. Exclude NaN values (skipna=True) or include NaN values (skipna=False)

Upvotes: 2

Related Questions