I'm having trouble setting the name of a dataframe that I'm trying to write to a csv file.
def write_csv(df):
os.makedirs('Output_csv_files', exist_ok=True)
df.to_csv(f"{df}.csv")
return print("Success!")
This is making the contents of the dataframe the name of it rather than the name of the variable itself. For example, if my df's name is "walmart_df," it wouldn't name the csv file "walmart_df.csv" but rather "[whatever the contents of the dataframe are].csv". How can I fix this?