Then you need to create a Pandas dataframe first. Then, create a HttpResponse object (using Django). It is important that this object should have content_type='text/csv'. Set the Content-Disposition parameter like this:
response['Content-Disposition'] = 'attachment; filename="result.csv"'
This will make that the file that the user downloads will have the default name 'result.csv'. Then use the created HttpResponse object as the place into which Pandas should save the dataframe as CSV file:
And finally, you can return the response object from the corresponding Django view.