
def iterative_imputer(df, cols, operator, target_value ):
    
# compare iterative imputation strategies for the horse colic dataset
    from numpy import mean
    from numpy import std
    from pandas import read_csv
    from sklearn.ensemble import RandomForestClassifier
    from sklearn.experimental import enable_iterative_imputer
    from sklearn.impute import IterativeImputer
    from sklearn.model_selection import cross_val_score
    from sklearn.model_selection import RepeatedStratifiedKFold
    from sklearn.pipeline import Pipeline
    from matplotlib import pyplot
    # load dataset
    url = 'https://raw.githubusercontent.com/jbrownlee/Datasets/master/horse-colic.csv'
    dataframe = read_csv(url, header=None, na_values='?')
    # split into input and output elements
    data = dataframe.values
    ix = [i for i in range(data.shape[1]) if i != 23]
    X, y = data[:, ix], data[:, 23]
    # evaluate each strategy on the dataset
    results = list()
    strategies = ['ascending', 'descending', 'roman', 'arabic', 'random']
    for s in strategies:
        # create the modeling pipeline
        pipeline = Pipeline(steps=[('i', IterativeImputer(imputation_order=s)), ('m', RandomForestClassifier())])
        # evaluate the model
        cv = RepeatedStratifiedKFold(n_splits=10, n_repeats=3, random_state=1)
        scores = cross_val_score(pipeline, X, y, scoring='accuracy', cv=cv, n_jobs=-1)
        # store results
        results.append(scores)
        print('>%s %.3f (%.3f)' % (s, mean(scores), std(scores)))
    # plot model performance for comparison
    pyplot.boxplot(results, labels=strategies, showmeans=True)
    pyplot.xticks(rotation=45)
    pyplot.show()
numpy.mean numpy.std