def to_binary(df, variable_names):
    """
    Recode specified variables of dataframe to binary; any positive value is
    set to 1 and all other values are set to 0. This replaces the existing
    column(s).
    
    Parameters
    ----------
    df : pandas DataFrame
        dataframe containing variables to be recoded
    variable_names : dict
        list of variable names to recode to binary

    Returns
    -------
    recoded_df : pandas DataFrame
        dataframe containing new variables with coding reversed
    """
    recoded_df = df.copy()
    recoded_df[variable_names] = (
            recoded_df[variable_names]
            .astype(bool)
            .astype("int64")
            )
    return recoded_df