import os


def remove_file(path):
    try:
        os.remove(path)
    except Exception as e:
        print(e)


def save_df_to_csv(df, file):
    print(df.head(3))
    base_dir = os.getcwd()
    data_dir = os.path.join(base_dir, "_data")
    full_path = os.path.join(data_dir, file)
    remove_file(full_path)
    df.to_csv(full_path, sep="|", index=False)
