Pandas DataFrame mean()

Pandas dataframe.mean() function returns the mean of the values for the requested axis. If the method is applied on a pandas series object, then the method returns a scalar value which is the mean value of all the observations in the Pandas Dataframe. If the method is applied on a Pandas Dataframe object, then the method returns a Pandas series object which contains the mean of the values over the specified axis.

Syntax: DataFrame.mean(axis=0, skipna=True, level=None, numeric_only=False, **kwargs)

Parameters :

  • axis : {index (0), columns (1)}
  • skipna : Exclude NA/null values when computing the result
  • level : If the axis is a MultiIndex (hierarchical), count along a particular level, collapsing into a Series
  • numeric_only : Include only float, int, boolean columns. If None, will attempt to use everything, then use only numeric data. Not implemented for Series.

Returns : mean : Series or DataFrame (if level specified)

Pandas DataFrame mean() Method

Python is a great language for doing data analysis, primarily because of the fantastic ecosystem of data-centric Python packages. Pandas is one of those packages and makes importing and analyzing data much easier.

Similar Reads

Pandas DataFrame mean()

Pandas dataframe.mean() function returns the mean of the values for the requested axis. If the method is applied on a pandas series object, then the method returns a scalar value which is the mean value of all the observations in the Pandas Dataframe. If the method is applied on a Pandas Dataframe object, then the method returns a Pandas series object which contains the mean of the values over the specified axis....

Pandas DataFrame.mean() Examples

Example 1:...