Django: Httpresponse with file object and updating field value - django

I'm having trouble with saving/updating a value to my database table after the Httpresponse is created and am looking for any tips, help, pointers, etc. I am passing a pdf object from my database to the browser, which works perfectly when the updating code is not in the model. With the code as below, I get a Django Unicode Decode Error. The exception states : "'utf8' codec can't decode bytes in position 564-565: invalid data." The odd thing is that this error does not occur when I am not trying to update the pdf_printed field (meaning no decoding error occurs normally, I get the pdf object to display without this problem), so wondering if those two methods are somehow clashing... seems like the obj.save may be the issue. Again, thanks for any insight to this issue!
I should also add that the update code manages to update the field; it just doesn't display the pdf object.
from django.contrib import admin
from django.contrib.auth.models import User
from django.pdf.models import ABC
from django.http import HttpResponse
class ABCAdmin(admin.ModelAdmin):
actions = ['print_selected_pdf']
def get_user(self):
return '%s'%(self.user.username)
def create_pdf(self, queryset):
response = HttpResponse(mimetype="application/pdf")
response['Content-Disposition'] = 'attachment; filename=form.pdf'
for obj in queryset:
response.write(obj.form)
#update the pdf_printed to true
obj.pdf_printed=True
obj.save()
return response
def print_selected_pdf(self, request, queryset):
# prints the pdfs for those that are selected,
# regardless if the pdf_printed field is true or false
qs = queryset.filter(pdf_printed__exact=0)
return self.create_pdf(qs)
print_selected_pdf.short_description = "Print PDF"
admin.site.register(ABC, ABCAdmin)
Traceback:
Environment:
Request Method: POST
Request URL: http://127.0.0.1:8000/admin/pdf/abc/
Django Version: 1.1
Python Version: 2.5.2
Installed Applications:
['django.contrib.auth',
'django.contrib.contenttypes',
'django.contrib.sessions',
'django.contrib.sites',
'django.contrib.admin',
'djangostuff.pdf']
Installed Middleware:
('django.middleware.common.CommonMiddleware',
'django.contrib.sessions.middleware.SessionMiddleware',
'django.contrib.auth.middleware.AuthenticationMiddleware')
Traceback:
File "/usr/lib/python2.5/site-packages/django/core/handlers/base.py" in get_response
92. response = callback(request, *callback_args, **callback_kwargs)
File "/usr/lib/python2.5/site-packages/django/contrib/admin/options.py" in wrapper
226. return self.admin_site.admin_view(view)(*args, **kwargs)
File "/usr/lib/python2.5/site-packages/django/views/decorators/cache.py" in _wrapped_view_func
44. response = view_func(request, *args, **kwargs)
File "/usr/lib/python2.5/site-packages/django/contrib/admin/sites.py" in inner
186. return view(request, *args, **kwargs)
File "/usr/lib/python2.5/site-packages/django/contrib/admin/options.py" in changelist_view
912. response = self.response_action(request, queryset=cl.get_query_set())
File "/usr/lib/python2.5/site-packages/django/contrib/admin/options.py" in response_action
694. response = func(self, request, queryset.filter(pk__in=selected))
File "/home/user/django/djangostuff/../djangostuff/pdf/admin.py" in print_selected_pdf
50. return self.create_pdf(qs)
File "/home/user/django/djangostuff/../djangostuff/pdf/admin.py" in create_pdf
43. obj.save()
File "/usr/lib/python2.5/site-packages/django/db/models/base.py" in save
410. self.save_base(force_insert=force_insert, force_update=force_update)
File "/usr/lib/python2.5/site-packages/django/db/models/base.py" in save_base
474. rows = manager.filter(pk=pk_val)._update(values)
File "/usr/lib/python2.5/site-packages/django/db/models/query.py" in _update
444. return query.execute_sql(None)
File "/usr/lib/python2.5/site-packages/django/db/models/sql/subqueries.py" in execute_sql
120. cursor = super(UpdateQuery, self).execute_sql(result_type)
File "/usr/lib/python2.5/site-packages/django/db/models/sql/query.py" in execute_sql
2369. cursor.execute(sql, params)
File "/usr/lib/python2.5/site-packages/django/db/backends/util.py" in execute
22. sql = self.db.ops.last_executed_query(self.cursor, sql, params)
File "/usr/lib/python2.5/site-packages/django/db/backends/__init__.py" in last_executed_query
213. u_params = tuple([to_unicode(val) for val in params])
File "/usr/lib/python2.5/site-packages/django/db/backends/__init__.py" in <lambda>
211. to_unicode = lambda s: force_unicode(s, strings_only=True)
File "/usr/lib/python2.5/site-packages/django/utils/encoding.py" in force_unicode
92. raise DjangoUnicodeDecodeError(s, *e.args)
Exception Type: DjangoUnicodeDecodeError at /admin/pdf/abc/
Exception Value: 'utf8' codec can't decode bytes in position 564-565: invalid data. You passed in '%PDF-1.3\n1 0 obj\n<<\n/Kids [ 4 0 R 5 0 R ]\n/Type /Pages\n/Count 2\n>>\nendobj\n2 0 obj\n<<\n/Producer (Python PDF Library \\055 http\\072\\057\\057pybrary\\056net\\057pyPdf\\057)\n>>\nendobj\n3 0 obj\n<<\n/Type /Catalog\n/Pages 1 0 R\n>>\nendobj\n4 0 obj\n<<\n/Parent 1 0 R\n/Contents 6 0 R\n/Resources 7 0 R\n/Rotate 0\n/CropBox [ 0 0 612 792 ]\n/MediaBox [ 0 0 612 792 ]\n/Type /Page\n>>\nendobj\n5 0 obj\n<<\n/Parent 1 0 R\n/Contents 17 0 R\n/Resources 18 0 R\n/Rotate 0\n/CropBox [ 0 0 612 792 ]\n/MediaBox [ 0 0 612 792 ]\n/Type /Page\n>>\nendobj\n6 0 obj\n<<\n/Length 4167\n/Filter /FlateDecode\n>>\nstream\nh\xde\xec[[o\xe36\x16~\xcf\xaf \n\x14\x90\x8a\xb1*\x92\xbaP}Yt\xda\xed\xec\x14\xdb\xe9l\x93\xc5b1\xe9\x83b\xcb\xb1&\x8e\x94Jr\x82\xfc\xfb=\x17\xd2\x96\x14G\xee\xb4\xc5n\x84m\x06cQ\x14/\xe7;<$?\x1e\x92_\xbe9\x97\xe2\xba={}q\xf6\xe5\xc5\x85\x12R\\\xac\xcf\xa4\x0e\xb2$5"\x84\x7f.\xac\xb2\xc0(\x91\xa4:0\xe2\xe2\xf6,\x14\xd7\xf0\xffb\x89?\x0fg\xdewe\xd3v\xe2]~[\xf8\x17\x1f\xcf\xfezq&\xe9\xfb\x1bx~\x0f\x85|\x142\x08\xd3L<\x08\x19\x8a\x1f\xc4\x87\x9fC\xb1\x82O\xa58Sq\x14D"I\xd2#\x1b\xb1P*\nb|FA\x98\x88\xa68{\xfd\x05$\xfb(\xce~\x01\xc1H\x1a\'G\x92\x04&\x12\xcb[\x8aEq\x16J\x07Rl\xcf\xce\xf7)\xa5\tR\x05\xa1?\x13\xbd\x84Dg\xff#\x1b;jYF\x07lY2r\xa6\xe5\xfd=?fO`\tq\x02\xd9"2\x00\xa8k\xa1L\x18\xa4\xd1\xb4\xc5p\xf9\x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xcb\xaal\xbb&\xef\xea&\xa0Ja%\x12\xa4:\x02\xca\x87,\xd0\x00\x17\x84uG$\xe2(\x0c\xb4\x884\x10D\\\x83\xacG\xcb\xe9c$\x12\x87\x0e\xa1\xa3\x04\xb3X\x169\x00\xc1\x18$6\x9a\xc2\xb95\x08\x82\x07\xd0\x03\xf6)\xb0*\xe6|8\xb3\xdf\x08~\x05\xeb\xa4\xf1\x04\xc3\xbb\n\x07\x98\x88\x86\x13M\xac\x01\xbfa\xd7\xa0\xaf-\xbf\xff\xc5!\xc2\xb5\xd5a\xb9\x14\xc3H*\xb4\xc2i\xb0\xcf\x8c\x15\xae\xba\x16`\xbd\x89\x80^\x07\xc1\x18\x92Q\x08\xba\xa9\xc1\'GKZ\x8fqj\x0e\x87\x98B\xdae\x1a\xc5\x9b}\x01\x87\x1fHC\x85\xd3KhS\x86\x94\xf9\xea\x0b&\xe3\x07\xd2|L\xa31\xad\x005\x10\xf8\xf4\x88\x83\x02&\xe1\xc3B\xf2\x00V\x86P\xa9z\x99p\x8f\x81\x94!\x18\x8c\x19\xa2\xf4dx\x1c\x1b\xb6\xe4\x9c\xb0a\x0b\x8e\xb1\xa9g\xb0efV\xd8\x14\xd8\xd9\x13l\xfa86\x05\x83Bdf\x84\r\xecLF#l\xd13\xd8\xb2h^\xd8\xc0\xce\x9e`\x8b\x8fc\xd3\x91\n\xe2\x17:t\x1e\x9d\x82\xc0\xce\xd4\x08Z\xf2\x0c\xb4,\x9c\x1740\xb31\xb4\xf48\xb4H\x9bYA\x8b\xc0\xca\xc6\xd0\xcc3\xd0\x0c\xf0\xbc\x19!\x03#S\xa3\x19\xdc\xcb\x8eC\x8b\x91\x80\xce\x07Z\x0cF\xa6\xe2,{2q3-\x99\xdey\x01\xa6\tB%\ndK0\xab\xf7m\xde=q\x8b\'\x19\xf2\xc9\x04\x17~F\xa0\x13C\x8f\xb7QT\x8c\x9f&R(i\x02sH\x91F\xb8\xd12\xe5X\xb7\x82I\xdc\x12\xfa\x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xccT\x08\xdaRafM\xfe?\x02\x0c\x00.\xce\xb1\x1d\n\nendstream\nendobj\n7 0 obj\n<<\n/ExtGState <<\n/GS1 8 0 R\n>>\n/Font <<\n/TT8 9 0 R\n/TT2 11 0 R\n/TT4 13 0 R\n/TT6 15 0 R\n>>\n/ProcSet [ /PDF /Text ]\n>>\nendobj\n8 0 obj\n<<\n/OPM 1\n/Type /ExtGState\n/SM 0.02000\n/OP false\n/SA false\n/op false\n>>\nendobj\n9 0 obj\n<<\n/FirstChar 48\n/Widths [ 600 0 600 600 0 600 600 0 600 600 ]\n/Encoding /WinAnsiEncoding\n/Type /Font\n/BaseFont /CourierNewPSMT\n/LastChar 57\n/FontDescriptor 10 0 R\n/Subtype /TrueType\n>>\nendobj\n10 0 obj\n<<\n/FontBBox [ -21 -680 638 1021 ]\n/StemV 42\n/Descent -300\n/XHeight -578\n/Flags 34\n/FontStretch /Normal\n/Ascent 832\n/FontName /CourierNewPSMT\n/Type /FontDescriptor\n/FontWeight 400\n/ItalicAngle 0\n/FontFamily (Courier New)\n/CapHeight 578\n>>\nendobj\n11 0 obj\n<<\n/FirstChar 32\n/Widths [ 250 0 0 0 0 0 0 0 333 333 0 0 0 333 250 0 500 500 500 500 500 500 500 500 500 500 333 0 0 0 0 500 0 722 667 722 722 0 611 0 0 389 0 0 667 944 722 778 611 0 722 556 667 722 0 0 0 722 0 0 0 0 0 0 0 500 556 444 556 444 333 500 556 278 0 556 278 833 556 500 556 0 444 389 333 556 500 722 0 500 ]\n/Encoding /WinAnsiEncoding\n/Type /Font\n/BaseFont /TimesNewRomanPS-BoldMT\n/LastChar 121\n/FontDescriptor 12 0 R\n/Subtype /TrueType\n>>\nendobj\n12 0 obj\n<<\n/FontBBox [ -558 -307 2000 1026 ]\n/StemV 136\n/Descent -216\n/XHeight -546\n/Flags 34\n/FontStretch /Normal\n/Ascent 891\n/FontName /TimesNewRomanPS-BoldMT\n/Type /FontDescriptor\n/FontWeight 700\n/ItalicAngle 0\n/FontFamily (Times New Roman)\n/CapHeight 656\n>>\nendobj\n13 0 obj\n<<\n/FirstChar 32\n/Widths [ 250 0 408 0 0 833 0 0 333 333 0 0 250 0 250 0 500 500 500 500 500 500 500 500 500 500 278 0 0 0 0 0 0 0 667 667 0 0 556 0 722 333 0 0 0 0 722 722 556 0 0 556 611 0 0 0 0 0 0 0 0 0 0 0 0 444 500 444 500 444 333 500 500 278 278 500 278 778 500 500 500 500 333 389 278 500 500 722 0 500 ]\n/Encoding /WinAnsiEncoding\n/Type /Font\n/BaseFont /TimesNewRomanPSMT\n/LastChar 121\n/FontDescriptor 14 0 R\n/Subtype /TrueType\n>>\nendobj\n14 0 obj\n<<\n/FontBBox [ -568 -307 2000 1007 ]\n/StemV 82\n/Descent -216\n/XHeight -546\n/Flags 34\n/FontStretch /Normal\n/Ascent 891\n/FontName /TimesNewRomanPSMT\n/Type /FontDescriptor\n/FontWeight 400\n/ItalicAngle 0\n/FontFamily (Times New Roman)\n/CapHeight 656\n>>\nendobj\n15 0 obj\n<<\n/FirstChar 47\n/Widths [ 278 556 556 556 556 556 556 556 556 556 556 ]\n/Encoding /WinAnsiEncoding\n/Type /Font\n/BaseFont /ArialMT\n/LastChar 57\n/FontDescriptor 16 0 R\n/Subtype /TrueType\n>>\nendobj\n16 0 obj\n<<\n/FontBBox [ -665 -325 2000 1006 ]\n/StemV 88\n/Descent -211\n/XHeight 515\n/Flags 32\n/FontStretch /Normal\n/Ascent 905\n/FontName /ArialMT\n/Type /FontDescriptor\n/FontWeight 400\n/ItalicAngle 0\n/FontFamily (Arial)\n/CapHeight 718\n>>\nendobj\n17 0 obj\n<<\n/Length 3133\n/Filter /FlateDecode\n>>\nstream\nh\xde\xd4\x9bK\x8f\xe3\xb8\x11\x80\xef\xfe\x15\xc4\x02\x01\xa4\x00\xe6\x8a\x14II\xa7\x00\xc1\x06\x13\x0c\xb0#\x82\xf1m\xb0\x07\x8f[\xfd\xd8\xf1\xb4:\xb6;\x8d\xfe\xf7\xa9b\x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db\x97\x1c\xbah_\x17ty\xff\x12CG\xfeuA\x97509pd`\x17tY\x07\x93CG\x0evA\x97\xb701xla\x17xy\x0f\x93\x83G\x1ev\x81\x97711xlb\x17xy\x17\x93\x83G.v\x81\x97\xb719\xbeB6veI\xcf\xfb\x98\x85\xc7\xb4r|\xcc\x1a\xed\xaa\xdb}L\n\x1d\xfbXJ7\xe3cb\xe8\xc8\xc7R\xba\x19\x1f\x93B\xc7>\x96\xd2\xe5}L\x0c\x1c\xfbXJ\x97\xf711t\xecc)\xdd\x8c\x8fI\xc1\x1b},\xc5\x9b\xf111x\xecc)\xde\x8c\x8fI\xc1\x1b},\xc5\x9b\xf111x\xecc)\xde\x8c\x8f\x89\xf1\x15\xf6\xb1\xcb%\x9d\x94\xc5\xd4\xba\x0b`4\xf1\x1e\xde\xae\x8d\x0eV5pK\x15\xbf\xca\\\xea\xaa\xf2N R\n>>\n/ProcSet [ /PDF /Text ]\n>>\nendobj\nxref\n0 19\n0000000000 65535 f \n0000000009 00000 n \n0000000074 00000 n \n0000000175 00000 n \n0000000224 00000 n \n0000000365 00000 n \n0000000508 00000 n \n0000004748 00000 n \n0000004880 00000 n \n0000004967 00000 n \n0000005168 00000 n \n0000005423 00000 n \n0000005890 00000 n \n0000006160 00000 n \n0000006616 00000 n \n0000006880 00000 n \n0000007085 00000 n \n0000007328 00000 n \n0000010535 00000 n \ntrailer\n<<\n/Size 19\n/Root 3 0 R\n/Info 2 0 R\n>>\nstartxref\n10668\n%%EOF\n' (<type 'str'>)

Currently Django doesn't support storing binary data in the database. I guess you inserted your data some other way. Anytime you call save() on your model containing binary data, you'll get a UnicodeDecodeError exception.
Anyway, as you state in your comment, using QuerySet.update works (since the value of this field isn't submitted to the database). If your model has the auto-generated id AutoField, you can try something like this as a workaround:
ABC.objects.filter(pk=obj.pk).update(pdf_printed='1')

Related

Trying to save a PDF string results in UnicodeDecodeError with WeasyPrint

So far this is my code:
from django.template import (Context, Template) # v1.11
from weasyprint import HTML # v0.42
import codecs
template = Template(codecs.open("/path/to/my/template.html", mode="r", encoding="utf-8").read())
context = Context({})
html = HTML(string=template.render(context))
pdf_file = html.write_pdf()
#with open("/path/to/my/file.pdf", "wb") as f:
# f.write(self.pdf_file)
Errorstack:
[17/Jan/2019 08:14:13] INFO [handle_correspondence:54] 'utf8' codec can't
decode byte 0xe2 in position 10: invalid continuation byte. You passed in
'%PDF-1.3\n%\xe2\xe3\xcf\xd3\n1 0 obj\n<</Author <> /Creator (cairo 1.14.6
(http://cairographics.org))\n /Keywords <> /Producer (WeasyPrint 0.42.3
\\(http://weasyprint.org/\\))>>\nendobj\n2 0 obj\n<</Pages 3 0 R /Type
/Catalog>>\nendobj\n3 0 obj\n<</Count 1 /Kids [4 0 R] /Type
/Pages>>\nendobj\n4 0 obj\n<</BleedBox [0 0 595 841] /Contents 5 0 R
/Group\n <</CS /DeviceRGB /I true /S /Transparency /Type /Group>>
MediaBox\n [0 0 595 841] /Parent 3 0 R /Resources 6 0 R /TrimBox [0 0 595
841]\n /Type /Page>>\nendobj\n5 0 obj\n<</Filter /FlateDecode /Length 15
0 R>>\nstream\nx\x9c+\xe4*T\xd0\x0fH,)I-\xcaSH.V\xd0/0U(N\xceS\xd0O4PH/\xe62P0P0\xb54U\xb001T(JUH\xe3\n\x04B\x00\x8bi\r\x89\nendstream\nendobj\n6 0
obj\n<</ExtGState <</a0 <</CA 1 /ca 1>>>> /Pattern <</p5 7 0
R>>>>\nendobj\n7 0 obj\n<</BBox [0 1123 794 2246] /Length 8 0 R /Matrix
[0.75 0 0 0.75 0 -843.5]\n /PaintType 1 /PatternType 1 /Resources
<</XObject <</x7 9 0 R>>>>\n /TilingType 1 /XStep 1588 /YStep
2246>>\nstream\n /x7 Do\n \n\nendstream\nendobj\n8 0 obj\n10\nendobj\n9 0
obj\n<</BBox [0 1123 794 2246] /Filter /FlateDecode /Length 10 0 R
/Resources\n 11 0 R /Subtype /Form /Type /XObject>>\nstream\nx\x9c+\xe4\nT(\xe42P0221S0\xb74\xd63\xb3\xb4T\xd05442\xd235R(JU\x08W\xc8\xe3*\xe42T0\x00B\x10\t\x942VH\xce\xe5\xd2O4PH/V\xd0\xaf04Tp\xc9\xe7\n\x04B\x00`\xf0\x10\x11\nendstream\nendobj\n10 0 obj\n77\nendobj\n11 0 obj\n<</ExtGState
<</a0 <</CA 1 /ca 1>>>> /XObject <</x11 12 0 R>>>>\nendobj\n12 0
obj\n<</BBox [0 1123 0 1123] /Filter /FlateDecode /Length 13 0 R
/Resources\n 14 0 R /Subtype /Form /Type /XObject>>\nstream\nx\x9c+\xe4\n
xe4\x02\x00\x02\x92\x00\xd7\nendstream\nendobj\n13 0 obj\n12\nendobj\n14 0
obj\n<<>>\nendobj\n15 0 obj\n58\nendobj\nxref\n0 16\n0000000000 65535
f\r\n0000000015 00000 n\r\n0000000168 00000 n\r\n0000000215 00000
n\r\n0000000270 00000 n\r\n0000000489 00000 n\r\n0000000620 00000
n\r\n0000000697 00000 n\r\n0000000923 00000 n\r\n0000000941 00000
n\r\n0000001165 00000 n\r\n0000001184 00000 n\r\n0000001264 00000
n\r\n0000001422 00000 n\r\n0000001441 00000 n\r\n0000001462 00000
n\r\ntrailer\n\n<</Info 1 0 R /Root 2 0 R /Size 16>>\nstartxref\n1481
n%%EOF\n' (<type 'str'>)
Actually it works via web request (returning the PDF as response) and via shell (manually writting the code). The code is tested and never gaves me problems. The files are saved with correct encoding, and setting the encoding kwarg in HTML doesn't help; also, the mode value of the template is correct, because I've seen other questions whose problem could be that.
However, I was adding a management command to use it periodically (for bigger PDFs I cannot do it via web request because the server's timeout could activate before finishing), and when I try to call it, I only get a UnicodeDecodeError saying 'utf8' codec can't decode byte 0xe2 in position 10: invalid continuation byte.
The PDF (at least from what I see) renders initially with this characters:
%PDF-1.3\n%\xe2\xe3\xcf\xd3\n1 0
which translates into this:
%PDF-1.3
%âãÏÓ
1 0 obj
So the problem is all about the character â. But it's a trap!
Instead, the problem is this line of code:
pdf_file = html.write_pdf()
Changing it to:
html.write_pdf()
Just works as expected!
So my question is: what type of reason could exists for Python to throw an UnicodeDecodeError when trying to assign a variable to a string? I've digged into weasyprint's code in my virtualenv, but I didn't see conversions out there.
So I don't know why, but now suddenly it works. I literally didn't modify anything: I just run the command again and it works.
I'm not marking the question as answered, as maybe in the future someone could have the same problem as me can try to post a correct one.
So disturbing.
EDIT
So it looks like I'm a very intelligent person who tries to set up the value of self.pdf_file, which is a models.FileField, to the content of the created PDF instead of the file itself.

pandas - group by: create aggregation function using multiple columns

I have the following data frame:
id my_year my_month waiting_time target
001 2018 1 95 1
002 2018 1 3 3
003 2018 1 4 0
004 2018 1 40 1
005 2018 2 97 1
006 2018 2 3 3
007 2018 3 4 0
008 2018 3 40 1
I want to groupby my_year and my_month, then in each group I want to compute the my_rate based on
(# of records with waiting_time <= 90 and target = 1)/ total_records in the group
i.e. I am expecting output like:
my_year my_month my_rate
2018 1 0.25
2018 2 0.0
2018 3 0.5
I wrote the following code to compute the desired value my_rate:
def my_rate(data):
waiting_time_list = data['waiting_time']
target_list = data['target']
total = len(data)
my_count = 0
for i in range(len(data)):
if total_waiting_time_list[i] <= 90 and target_list[i] == 1:
my_count += 1
rate = float(my_count)/float(total)
return rate
df.groupby(['my_year','my_month']).apply(my_rate)
However, I got the following error:
KeyError 0
KeyErrorTraceback (most recent call last)
<ipython-input-29-5c4399cefd05> in <module>()
17
---> 18 df.groupby(['my_year','my_month']).apply(my_rate)
/opt/conda/envs/python2/lib/python2.7/site-packages/pandas/core/groupby.pyc in apply(self, func, *args, **kwargs)
714 # ignore SettingWithCopy here in case the user mutates
715 with option_context('mode.chained_assignment', None):
--> 716 return self._python_apply_general(f)
717
718 def _python_apply_general(self, f):
/opt/conda/envs/python2/lib/python2.7/site-packages/pandas/core/groupby.pyc in _python_apply_general(self, f)
718 def _python_apply_general(self, f):
719 keys, values, mutated = self.grouper.apply(f, self._selected_obj,
--> 720 self.axis)
721
722 return self._wrap_applied_output(
/opt/conda/envs/python2/lib/python2.7/site-packages/pandas/core/groupby.pyc in apply(self, f, data, axis)
1727 # group might be modified
1728 group_axes = _get_axes(group)
-> 1729 res = f(group)
1730 if not _is_indexed_like(res, group_axes):
1731 mutated = True
<ipython-input-29-5c4399cefd05> in conversion_rate(data)
8 #print total_waiting_time_list[i], target_list[i]
9 #print i, total_waiting_time_list[i], target_list[i]
---> 10 if total_waiting_time_list[i] <= 90:# and target_list[i] == 1:
11 convert_90_count += 1
12 #print 'convert ', convert_90_count
/opt/conda/envs/python2/lib/python2.7/site-packages/pandas/core/series.pyc in __getitem__(self, key)
599 key = com._apply_if_callable(key, self)
600 try:
--> 601 result = self.index.get_value(self, key)
602
603 if not is_scalar(result):
/opt/conda/envs/python2/lib/python2.7/site-packages/pandas/core/indexes/base.pyc in get_value(self, series, key)
2426 try:
2427 return self._engine.get_value(s, k,
-> 2428 tz=getattr(series.dtype, 'tz', None))
2429 except KeyError as e1:
2430 if len(self) > 0 and self.inferred_type in ['integer', 'boolean']:
pandas/_libs/index.pyx in pandas._libs.index.IndexEngine.get_value (pandas/_libs/index.c:4363)()
pandas/_libs/index.pyx in pandas._libs.index.IndexEngine.get_value (pandas/_libs/index.c:4046)()
pandas/_libs/index.pyx in pandas._libs.index.IndexEngine.get_loc (pandas/_libs/index.c:5085)()
pandas/_libs/hashtable_class_helper.pxi in pandas._libs.hashtable.Int64HashTable.get_item (pandas/_libs/hashtable.c:13913)()
pandas/_libs/hashtable_class_helper.pxi in pandas._libs.hashtable.Int64HashTable.get_item (pandas/_libs/hashtable.c:13857)()
KeyError: 0
Any idea what I did wrong here? And how do I fix it? Thanks!
I believe better is use mean of boolean mask per groups:
def my_rate(x):
return ((x['waiting_time'] <= 90) & (x['target'] == 1)).mean()
df = df.groupby(['my_year','my_month']).apply(my_rate).reset_index(name='my_rate')
print (df)
my_year my_month my_rate
0 2018 1 0.25
1 2018 2 0.00
2 2018 3 0.50
Any idea what I did wrong here?
Problem is waiting_time_list and target_list are not lists, but Series:
waiting_time_list = data['waiting_time']
target_list = data['target']
print (type(waiting_time_list))
<class 'pandas.core.series.Series'>
print (type(target_list))
<class 'pandas.core.series.Series'>
So if want indexing it failed, because in second group are indices 4,5, not 0,1.
if waiting_time_list[i] <= 90 and target_list[i] == 1:
For avoid it is possible convert Series to list:
waiting_time_list = data['waiting_time'].tolist()
target_list = data['target'].tolist()

Sklearn CountVectorizer vocabulary is not complete

Consider the following example:
tf_vectorizer = CountVectorizer(max_df=1, min_df=0,
max_features=None,
stop_words=None)
all_docs = ['ETH:0x0000 00:17:A4:77:9C:04 09:00:2B:00:00:05 0 PortA Unknown 755 0 45300 ETH FirstHourDay_21 LastHourDay_23 duration_6911 ThreatScore_nan ThreatCategory_nan False Anomaly_False',
'ETH:0x0000 00:17:A4:77:9C:04 09:00:2B:00:00:05 2 PortC Unknown 774 0 46440 ETH FirstHourDay_21 LastHourDay_23 duration_6911 ThreatScore_nan ThreatCategory_nan False Anomaly_False',
'ETH:0x0000 00:17:A4:77:9C:0A 09:00:2B:00:00:05 0 PortA Unknown 752 0 45120 ETH FirstHourDay_21 LastHourDay_23 duration_6913 ThreatScore_nan ThreatCategory_nan False Anomaly_False',
'ICMP 10.6.224.1 71.6.165.200 0 PortA 192 IP-ICMP 1 1 70 ICMP FirstHourDay_22 LastHourDay_22 duration_0 ThreatScore_122,127 ThreatCategory_21,23 True Anomaly_True',
'ICMP 10.6.224.1 71.6.165.200 2 PortC 192 IP-ICMP 1 1 70 ICMP FirstHourDay_22 LastHourDay_22 duration_0 ThreatScore_122,127 ThreatCategory_21,23 True Anomaly_True',
'ICMP 10.6.224.1 185.93.185.239 0 PortA 192 IP-ICMP 1 1 70 ICMP FirstHourDay_22 LastHourDay_22 duration_0 ThreatScore_127 ThreatCategory_23 True Anomaly_True']
tf_v = tf_vectorizer.fit(all_docs)
The obtained vocabulary is:
{'0a': 0,
'185': 1,
'239': 2,
'45120': 3,
'45300': 4,
'46440': 5,
'752': 6,
'755': 7,
'774': 8,
'93': 9,
'duration_6913': 10,
'threatcategory_23': 11,
'threatscore_127': 12}
Some words are missing from the vocabulary such as ETH, FirstHourDay_22, Anomaly_True.
Why is this? how can I have a full vocabulary?
EDIT:
The error is probably due to the token_pattern value in CountVectorizer
EDIT:
I suggest to riconsider the problem with the following variable:
all_docs=['ETH0x0000 0017A4779C04 09002B000005 0 PortA Unknown 755 0 45300 FirstHourDay21 LastHourDay23 duration6911 ThreatScorenan ThreatCategorynan False AnomalyFalse',
'ETH0x0000 0017A4779C04 09002B000005 2 PortC Unknown 774 0 46440 FirstHourDay21 LastHourDay23 duration6911 ThreatScorenan ThreatCategorynan False AnomalyFalse',
'ETH0x0000 0017A4779C0A 09002B000005 0 PortA Unknown 752 0 45120 FirstHourDay21 LastHourDay23 duration6913 ThreatScorenan ThreatCategorynan False AnomalyFalse',
'ICMP 10.6.224.1 71.6.165.200 0 PortA 192 IP-ICMP 1 1 70 FirstHourDay22 LastHourDay22 duration0 ThreatScore122,127 ThreatCategory21,23 True AnomalyTrue',
'ICMP 10.6.224.1 71.6.165.200 2 PortC 192 IP-ICMP 1 1 70 FirstHourDay22 LastHourDay22 duration0 ThreatScore122,127 ThreatCategory21,23 True AnomalyTrue',
'ICMP 10.6.224.1 185.93.185.239 0 PortA 192 IP-ICMP 1 1 70 FirstHourDay22 LastHourDay22 duration0 ThreatScore127 ThreatCategory23 True AnomalyTrue']

Tensorflow: TypeError: Expected string, got 1 of type 'int64' instead

I'm trying to create a logistic regression model in tensorflow.
When I try to execute model.fit(input_fn=train_input_fn, steps=200) I get the following error.
TypeError Traceback (most recent call last)
<ipython-input-44-fd050d8188b5> in <module>()
----> 1 model.fit(input_fn=train_input_fn, steps=200)
/home/praveen/anaconda/lib/python2.7/site-packages/tensorflow/contrib/learn/python/learn/estimators/estimator.pyc in fit(self, x, y, input_fn, steps, batch_size, monitors)
180 feed_fn=feed_fn,
181 steps=steps,
--> 182 monitors=monitors)
183 logging.info('Loss for final step: %s.', loss)
184 return self
/home/praveen/anaconda/lib/python2.7/site-packages/tensorflow/contrib/learn/python/learn/estimators/estimator.pyc in _train_model(self, input_fn, steps, feed_fn, init_op, init_feed_fn, init_fn, device_fn, monitors, log_every_steps, fail_on_nan_loss)
447 features, targets = input_fn()
448 self._check_inputs(features, targets)
--> 449 train_op, loss_op = self._get_train_ops(features, targets)
450
451 # Add default monitors.
/home/praveen/anaconda/lib/python2.7/site-packages/tensorflow/contrib/learn/python/learn/estimators/linear.pyc in _get_train_ops(self, features, targets)
105 if self._linear_feature_columns is None:
106 self._linear_feature_columns = layers.infer_real_valued_columns(features)
--> 107 return super(LinearClassifier, self)._get_train_ops(features, targets)
108
109 #property
/home/praveen/anaconda/lib/python2.7/site-packages/tensorflow/contrib/learn/python/learn/estimators/dnn_linear_combined.pyc in _get_train_ops(self, features, targets)
154 global_step = contrib_variables.get_global_step()
155 assert global_step
--> 156 logits = self._logits(features, is_training=True)
157 with ops.control_dependencies([self._centered_bias_step(
158 targets, self._get_weight_tensor(features))]):
/home/praveen/anaconda/lib/python2.7/site-packages/tensorflow/contrib/learn/python/learn/estimators/dnn_linear_combined.pyc in _logits(self, features, is_training)
298 logits = self._dnn_logits(features, is_training=is_training)
299 else:
--> 300 logits = self._linear_logits(features)
301
302 return nn.bias_add(logits, self._centered_bias())
/home/praveen/anaconda/lib/python2.7/site-packages/tensorflow/contrib/learn/python/learn/estimators/dnn_linear_combined.pyc in _linear_logits(self, features)
255 num_outputs=self._num_label_columns(),
256 weight_collections=[self._linear_weight_collection],
--> 257 name="linear")
258 return logits
259
/home/praveen/anaconda/lib/python2.7/site-packages/tensorflow/contrib/layers/python/layers/feature_column_ops.pyc in weighted_sum_from_feature_columns(columns_to_tensors, feature_columns, num_outputs, weight_collections, name, trainable)
173 transformer = _Transformer(columns_to_tensors)
174 for column in sorted(set(feature_columns), key=lambda x: x.key):
--> 175 transformed_tensor = transformer.transform(column)
176 predictions, variable = column.to_weighted_sum(transformed_tensor,
177 num_outputs,
/home/praveen/anaconda/lib/python2.7/site-packages/tensorflow/contrib/layers/python/layers/feature_column_ops.pyc in transform(self, feature_column)
353 return self._columns_to_tensors[feature_column]
354
--> 355 feature_column.insert_transformed_feature(self._columns_to_tensors)
356
357 if feature_column not in self._columns_to_tensors:
/home/praveen/anaconda/lib/python2.7/site-packages/tensorflow/contrib/layers/python/layers/feature_column.pyc in insert_transformed_feature(self, columns_to_tensors)
410 mapping=list(self.lookup_config.keys),
411 default_value=self.lookup_config.default_value,
--> 412 name=self.name + "_lookup")
413
414
/home/praveen/anaconda/lib/python2.7/site-packages/tensorflow/contrib/lookup/lookup_ops.pyc in string_to_index(tensor, mapping, default_value, name)
349 with ops.op_scope([tensor], name, "string_to_index") as scope:
350 shared_name = ""
--> 351 keys = ops.convert_to_tensor(mapping, dtypes.string)
352 vocab_size = array_ops.size(keys)
353 values = math_ops.cast(math_ops.range(vocab_size), dtypes.int64)
/home/praveen/anaconda/lib/python2.7/site-packages/tensorflow/python/framework/ops.pyc in convert_to_tensor(value, dtype, name, as_ref)
618 for base_type, conversion_func in funcs_at_priority:
619 if isinstance(value, base_type):
--> 620 ret = conversion_func(value, dtype=dtype, name=name, as_ref=as_ref)
621 if ret is NotImplemented:
622 continue
/home/praveen/anaconda/lib/python2.7/site-packages/tensorflow/python/ops/constant_op.pyc in _constant_tensor_conversion_function(v, dtype, name, as_ref)
177 as_ref=False):
178 _ = as_ref
--> 179 return constant(v, dtype=dtype, name=name)
180
181
/home/praveen/anaconda/lib/python2.7/site-packages/tensorflow/python/ops/constant_op.pyc in constant(value, dtype, shape, name)
160 tensor_value = attr_value_pb2.AttrValue()
161 tensor_value.tensor.CopyFrom(
--> 162 tensor_util.make_tensor_proto(value, dtype=dtype, shape=shape))
163 dtype_value = attr_value_pb2.AttrValue(type=tensor_value.tensor.dtype)
164 const_tensor = g.create_op(
/home/praveen/anaconda/lib/python2.7/site-packages/tensorflow/python/framework/tensor_util.pyc in make_tensor_proto(values, dtype, shape)
351 nparray = np.empty(shape, dtype=np_dt)
352 else:
--> 353 _AssertCompatible(values, dtype)
354 nparray = np.array(values, dtype=np_dt)
355 # check to them.
/home/praveen/anaconda/lib/python2.7/site-packages/tensorflow/python/framework/tensor_util.pyc in _AssertCompatible(values, dtype)
288 else:
289 raise TypeError("Expected %s, got %s of type '%s' instead." %
--> 290 (dtype.name, repr(mismatch), type(mismatch).__name__))
291
292
TypeError: Expected string, got 1 of type 'int64' instead.
I'm not sure which feature to check. Could somebody tell me how could debug this please? Thanks in advance
I had few categorical columns features whose data types are int64. So, I converted the columns from int to string. After that the fit step ran to completion. Apparently, tensorflow expects the categorical features dtype to be string.

Saving binary data in ColdFusion

I have a problem with saving a binary representation of a file to a file...
Let me show you my pain:
Everything starts with a file, file.pdf
Then the file is send via POST to a website with some additional data:
curl --data "sector=4&name=John&surname=Smith&email=john#smith.com&isocode=PL&theFile=$(cat file.pdf | base64)" http://localhost/awesomeUpload
then the data is received and decoded:
var decoded = BinaryDecode(data.theFile, "Base64");
then I attempt to save it by:
var theFilePath = ExpandPath("/localserver/temp/theFile.pdf");
fileWrite(theFilePath , data.theFile);
or:
var file_output_steam = CreateObject("java","java.io.FileOutputStream").init(theFilePath);
file_output_steam.write(data.theFile);
file_output_steam.close();
My files does not match ;(
the original one looks like
%PDF-1.5
%µµµµ
1 0 obj
<</Type/Catalog/Pages 2 0 R/Lang(pl-PL) /StructTreeRoot 13 0 R/MarkInfo<</Marked true>>>>
endobj
2 0 obj
<</Type/Pages/Count 1/Kids[ 3 0 R] >>
endobj
3 0 obj
<</Type/Page/Parent 2 0 R/Resources<</Font<</F1 5 0 R/F2 10 0 R>>/ProcSet[/PDF/Text/ImageB/ImageC/ImageI] >>/MediaBox[ 0 0 595.32 841.92] /Contents 4 0 R/Group<</Type/Group/S/Transparency/CS/DeviceRGB>>/Tabs/S/StructParents 0>>
where as the copy that went through ColdFusion looks like:
%PDF-1.5
%µµµµ
1 0 obj
<</Type/Catalog/Pages 2 0 R/Lang(pl-PL) /StructTreeRoot 13 0 R/MarkInfo<</Marked true>> B™[™ŘšBŚŘšBŹŐ\KÔYŮ\ËĐŰÝ[ťKŇÚYÖČČ—H€Đ¦VćFö& ĐŁ2ö& ĐŁĂÂőG—RővRő&VçB""ő&W6÷W&6W3ĂÂôföçCĂÂôcR"ôc"#ŕ˝AÉ˝ŤM•Ńl˝A˝Q•áĐ˝%µ…ť•˝%µ…ť•˝%µ…ť•%t€>/MediaBox[ 0 0 595.32 841.92] /Contents 4 0 R/Group<</Type/Group/S/Transparency/CS/DeviceRGB>>/Tabs/S/StructParents 0>B™[™ŘšBŤŘšBŹŃš[\‹Ń›]QXŰŮKÓ[™ÝMŚOŹBśÝ™X[CBž'cłB°Ś!8Ě1Ď]CsôŘQ&‰2  PäV˝ëËöĽ¨QŰge•ź
ďÂŃ,đť#"aKR•˘<1™[ä¸
(ÄňĄyoâ9S\Śĺ <ę8I±D¬‰#…Ć”ťLé‘ا÷ÍnU|WŸ‰t`ýuşąĽ\hlu&âĂ7ß
ů"Ĺ\Ŕ>pÇč÷÷.°ß’Ř——•‹ĚB™[™Ý™X[CB™[™ŘšBŤHŘšBŹŐ\Kћ۝ÔÝXť\KŐ\LĐ\ŮQ›ŰťĐPŃQJĐŘ[XśšKŃ[ŰŮ[™ËŇY[ť]KRŃ\ŘŮ[™[ť›ŰťČ
‹ŐŐ[šXŰŮHŚŹŹB™[™ŘšBŤŘšB–Č
Č—HB™[™ŘšBŤČŘšBŹĐ\ŮQ›ŰťĐPŃQJĐŘ[XśšKÔÝXť\KĐŇQ›Űť\L‹Ő\Kћ۝ĐŇQŃŇQX\ŇY[ť]KŃČLĐŇQŢ\Ý[R[™›Č‹Ń›Űť\ŘÜš\ÜH‹ŐČŚŕЦVćFö& ĐŁ‚ö& ĐŁĂÂô÷&FW&–ćr„–FVçF—G’’ő&Vv—7G'’„Fö&R’ő7WĆVÖVçBăŕЦVćFö& ĐŁ’ö& ĐŁĂÂőG—RôföçDFW67&—F÷"ôföçDć
please help