yasc.preprocessing.rf_fill_missing

yasc.preprocessing.rf_fill_missing(data, column, target=None, n_digits=0, **kwargs)

Fill missing values with predicted values output by a random forest regressor.

Parameters
datapandas.core.frame.DataFrame

Observed data.

columnstr

Name of the column to fill. This column should be a numeric.

targetstr, optional

Name of target column to predict. Defaults to None if data contains no target.

n_digitsint, optional

Precision in decimal digits to round the predicted values.

kwargsKeyword arguments

All keyword arguments that can be passed to sklearn.ensemble.RandomForestRegressor.

Returns
pandas.core.frame.DataFrame

Returns a data frame with missing values filled in column column.

Raises
TypeError

Raises a TypeError when column is not numeric.