I have a Pandas dataframe in my Flask app that I want to return as a CSV file.
return Response(df.to_csv())
The problem is that the output
This is pretty much the same solution but you can just pass the same info into Response:
return Response( df.to_csv(), mimetype="text/csv", headers={"Content-disposition": "attachment; filename=filename.csv"})