def write_output(init_dict, df):
    """The function converts the simulated variables to a panda data frame and saves the
    data in a txt and a pickle file.
    """
    source = init_dict['SIMULATION']['source']
    df.to_pickle(source + '.grmpy.pkl')
    with open(source + '.grmpy.txt', 'w') as file_:
        df.to_string(file_, index=False, na_rep='.', col_space=15, justify=
            'left')
    return df
