So during my last line of function, I wrote something like:
return pd.DataFrame(data), pd.DataFrame(data).to_csv(folder_path + \'/\' + csv_name)
I