pingouin.remove_rm_na

pingouin.remove_rm_na(data=None, dv=None, within=None, subject=None, aggregate='mean')[source]

Remove missing values in long-format repeated-measures dataframe.

Parameters
datadataframe

Long-format dataframe.

dvstring or list

Dependent variable(s), from which the missing values should be removed. If dv is not specified, all the columns in the dataframe are considered. dv must be numeric.

withinstring or list

Within-subject factor(s).

subjectstring

Subject identifier.

aggregatestring

Aggregation method if there are more within-factors in the data than specified in the within argument. Can be mean, median, sum, first, last, or any other function accepted by pandas.DataFrame.groupby().

Returns
datadataframe

Dataframe without the missing values.

Notes

If multiple factors are specified, the missing values are removed on the last factor, so the order of within is important.

In addition, if there are more within-factors in the data than specified in the within argument, data will be aggregated using the function specified in aggregate. Note that in the default case (aggregation using the mean), all the non-numeric column(s) will be dropped.