Skip to content
/ PyMICE Public

PyMICE is a Python package that provides a new method for missing data imputation in datasets with multiple imputations using chained equations (MICE)

Notifications You must be signed in to change notification settings

Pn7Hao/PyMICE

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 

Repository files navigation

PyMICE

PyMICE is a Python package that provides a new method for missing data imputation in datasets with multiple imputations using chained equations (MICE)
It is more efficient and resource-saving than the package of sklearn =))

How to use that :

def impute_with_mice(df, n_iterations=10):
    """
    Impute missing values using the MICE algorithm.

    Parameters:
    ----------
    df : pd.DataFrame
        The pandas dataframe containing the data to be imputed.
    n_iterations : int, optional
        The number of iterations to run the MICE algorithm. The default value is 10.

    Returns:
    -------
    imputed_df : pd.DataFrame
        The pandas dataframe with imputed values.
    """

    # Create a new instance of the MiceImputer class
    imputer = MiceImputer()

    # Impute missing values using the MICE algorithm and Bayesian Ridge regression
    imputed_df = pd.DataFrame(imputer.transform(df, BayesianRidge, n_iterations), columns=df.columns)

    return imputed_df

imputed_df = impute_with_mice(df, n_iterations=10)

About

PyMICE is a Python package that provides a new method for missing data imputation in datasets with multiple imputations using chained equations (MICE)

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages