Rescale variables in a DataFrame, excluding variables with NaNs and strings,
    excluding specified variables, and including specified variables.

def rescale_variables(
    df,
    variables_include = [],
    variables_exclude = []
    ):
    """
    Rescale variables in a DataFrame, excluding variables with NaNs and strings,
    excluding specified variables, and including specified variables.
    """
    variables_not_rescale = variables_exclude
    variables_not_rescale.extend(df.columns[df.isna().any()].tolist())                                    # variables with NaNs
    variables_not_rescale.extend(df.select_dtypes(include = ["object", "datetime", "timedelta"]).columns) # variables with strings
    variables_rescale = list(set(df.columns) - set(variables_not_rescale))
    variables_rescale.extend(variables_include)
    scaler = MinMaxScaler()
    df[variables_rescale] = scaler.fit_transform(df[variables_rescale])
    return df