Inside of a Django view:
my_names = ['Date','Open','High','Low','Close','Volume','B0','B1','B2','B3','B4','B5','B6','B7']
request.session['df'] = pd.read_csv( request.FILES.get('data'), names=my_names ).to_json()
if request.session.test_cookie_worked():
print('Test cookie worked! Deleting... ')
request.session.delete_test_cookie()
else:
request.session.set_test_cookie()
print('set test cookie')
Problem description
If I comment out the line "request.session['df'] = pd.read_csv( request.FILES.get('data'), names=my_names ).to_json()", then the first page load will print "set test cookie" on the first page load. On the second page load, the link 'Test cookie worked! Deleting..." will appear.
When I run the code as-is, the Terminal prints set test cookie on every single page load.
GitHub won't let me upload the csv file even though it's zipped. Let me know how I can send that to you.
Expected Output
The terminal output should alternate between 'set test cookie' and 'Test cookie worked!' on every page load.
Output of pd.show_versions()
Comment From: jreback
this is not a reproducible example; its also not clear what this has to do with pandas itself. more likely how you are using the results.
Comment From: jreback
you are likely to get more of a response on Stack Overflow; you need to post a complete self-reproducible example.