KitDocumentation

ColumnMean

Gets the mean value of one or more columns. Furthermore, can get the mean while being grouped by another column or category, perform a rolling mean or sliding window mean, can get the mean for only rows that meet a condition, and can add the result to the dataframe as a new column

Options

columns: Specifies columns to calculate mean values
where: Specifies a condition for the calculation
group: Groups the data before performing the operation
rolling: Specifies the rolling window overwhich to perform the calculation
addToDataframe: Indicates whether to add the result to the dataframe

Examples

Example 1 - Get Mean of a Single Column

The mean gives a quick sense of the central value of a numeric column. In this case, we compute the mean of the Temp3pm column to understand the typical afternoon temperature recorded in the dataset.
#> ColumnMean Temp3pm
AFLEFT 
weatherDfMean = weatherDf[Temp3pm].mean() AFRIGHT

Example 2 - Get Mean of Multiple Columns

To summarize several numeric columns at once, we can calculate their means in a single step. Here, we retrieve the average values for Temp3pm, Temp9am, MaxTemp, and MinTemp to provide a quick overview of typical temperature behavior.
#> ColumnMean Temp3pm Temp9am MaxTemp MinTemp
AFLEFT 
weatherDfMean = weatherDf [ [Temp3pm, Temp9am, MaxTemp, 'MinTemp'] ].mean() AFRIGHT