Data dodania Pytanie
2017-10-01 14:10 Return file using HttpResponse »
Good afternoon. I need to download data from database in excel format. Below, my code and its working correct when i'm trying to download file through...
(1) odpowiedzi
2017-10-01 13:10 Datafile not found, datafile generation failed in confusable_homoglyphs/categories.py »
I'm setting up a django project on an apache server. It is running fine on my PC under using manage.py runsslserver. When I load onto the apache ser...
(1) odpowiedzi
2017-10-01 03:10 Python refuses to iterate through lines in a file more than once »
I am writing a program that requires me to iterate through each line of a file multiple times: loops = 0 file = open("somefile.txt") while loops <...
(6) odpowiedzi
2017-10-01 01:10 The command "pipenv run" worked fine yesterday. Why I get an AttributeError today? »
I have a python script which I called via pipenv run python3 script.py Yesterday it worked fine, but today I get the following error: Traceback (...
(2) odpowiedzi
2017-09-30 15:09 Using python selenium to scrape time data »
I'm using the following lines of code to get the utime of an element. From the output I can see that I'm targeting the correct area and that the utime...
(1) odpowiedzi
2017-09-30 07:09 pip throws TypeError: parse() got an unexpected keyword argument 'transport_encoding' when trying to install new packages »
I am using the latest version of Anaconda3. I just installed it and I am trying to download some packages. I am using the Anaconda Prompt. While tryin...
(3) odpowiedzi
2017-09-30 03:09 Print the first n numbers of the fibonacci sequence in one expression »
So I've been messing around with Python a bit lately and I'm trying to find a way to output the nth number of the fibonacci sequence in a single expre...
(4) odpowiedzi
2017-09-30 01:09 Overlapping axis tick labels in logarithmic plots »
I have some code that worked very well a year or so ago using pyplot; I made a plot using plt.plot(x,y) using a logarithmic y-axis and replaced the y-...
(2) odpowiedzi
2017-09-30 01:09 duplicate key value violates unique constraint "auth_user_username_key"DETAIL: Key (username)=(None) already exists »
I want to register a user using a custom register model but I keep getting the following error : duplicate key value violates unique constraint "...
(1) odpowiedzi
2017-09-30 01:09 Django - Migration foreign key field type not matching current type »
I am working with MSSQL database and I have some tables that were already created before Django enters the show, so with inspectdb I got the models wi...
(0) odpowiedzi
2017-09-30 00:09 Flask-WTF CSRF token is missing »
Following the documentation of flask-wtf (v. 0.14.2, python 3.4.6) here I get a CSRF token is missing 400 error when reacting on a onchange event from...
(1) odpowiedzi
2017-09-29 22:09 Poor performance of C++ function in Cython »
I have this C++ function, which I can call from Python with the code below. The performance is only half compared to running pure C++. Is there a way ...
(1) odpowiedzi
2017-09-29 21:09 Lazily generating prime in Common Lisp »
I'm trying to generate prime numbers in a pythonic way- that is, using generators. The python code would be more or less the following def divisor_i...
(1) odpowiedzi
2017-09-29 15:09 Split a list with n*n elements into n lists with n elements in every list »
I am trying to come up with a function that takes an input x and split a big list with the number of elements x*x into x smaller lists with x elements...
(5) odpowiedzi
2017-09-29 13:09 Get percentage of rows (strings) that fulfil a certain condition in a pandas data frame »
I have this data frame: df = pd.DataFrame({"A": ["Used", "Not used", "Not used", "Not used", "Used", "Not used", "Used", "Us...
(2) odpowiedzi
2017-09-29 13:09 How can I get my params in QueryDict? »
I use the ajax pass the data to views.py: var params = {'nood_id':'f55dbe56-7fa8-4d13-8e1e-2dc67499b6ac'} $.ajax({ type:'post', url:'/api/noo...
(1) odpowiedzi
2017-09-29 01:09 How to detect if a function has been defined locally? »
In Python, I have a decorator that has to skip any real work if a function is defined locally in the one that calls it. I made a simple testing script...
(2) odpowiedzi
2017-09-28 20:09 Simple python code is not working »
The following code is not working: person = input('Enter your name: ') print('Hello', person) Instead of printing Hello <name> it is giving ...
(2) odpowiedzi
2017-09-28 20:09 Fastest way to sum over rows of sparse matrix »
I have a big csr_matrix(1M*1K) and I want to add over rows and obtain a new csr_matrix with the same number of columns but reduced number of rows. Act...
(1) odpowiedzi
2017-09-28 15:09 How to create an increasing, multi-dimensional array in numpy »
I am trying to perform inverse warping given a homography matrix, and to do that efficiently I need a numpy array that looks like this: ([[0, 0, 1], ...
(4) odpowiedzi
2017-09-28 13:09 How to add not null unique value to existing Django Model with default attribute »
I need to add slug field to django model, and i thing it's better when it not null. So i'm trying to add slug to model slug = models.SlugField( '...
(1) odpowiedzi
2017-09-28 12:09 Django ORM Group By ID »
I am trying to get some information from my table; total price, total trip etc between two dates. Here is my query start_date = Utils.subtract_day(da...
(2) odpowiedzi
2017-09-28 12:09 How to reshape a multi-column dataframe by index? »
Following from here . The solution works for only one column. How to improve the solution for multiple columns. i.e If I have a dataframe like df= p...
(4) odpowiedzi
2017-09-28 07:09 Python style guide: intermittent variables »
I was searching for a Python style guide in terms of "intermittent variables" and readability. The code that I develope will be mainly used by non-pro...
(0) odpowiedzi
2017-09-27 19:09 Is there an alternative to python's permutations for generator input? »
I am trying to use an unbounded generator in itertools.permutations but it doesn't seem to be working. The return generator is never created because t...
(2) odpowiedzi
2017-09-27 19:09 The TypeError in python »
I'm trying to make a challenge for one of the courses I'm following. I'm new to programming, but I'm eager to learn. Can you tell me in detail why thi...
(3) odpowiedzi
2017-09-27 14:09 Is there a function in Python that shuffle data by data blocks? »
For example, as to [1 2 3 4 5 6] Shuffle the data while keeping data blocks(including 2 data) as before. And we'll acquire: [3 4 1 2 5 6] Any wa...
(6) odpowiedzi
2017-09-27 14:09 ImportError : no module named 'models' »
The following code gives this error ImportError : no module named 'models' I don't know why. I am trying to customize my own registration form i...
(1) odpowiedzi
2017-09-27 11:09 How to import models from one app to another app in Django? »
I am trying to reference a model (Person) from one app, in the views-file of another app. Unfortunately, I get an "unresolved reference"-error. Is it ...
(4) odpowiedzi
2017-09-27 11:09 Making use of Twitter API to collect users tweet »
I am trying to create an Oauth based twitter application for gathering tweets or texts data of the person who authorize the app and allow me to gather...
(0) odpowiedzi
2017-09-27 07:09 ImportError: No module named naive_bayes »
I just installed sklearn, my program runs no problem when I import it into the code. However, whenever I try to access the naive_bayes module, I get ...
(2) odpowiedzi
2017-09-27 02:09 codecs.open(utf-8) fails to read plain ASCII file »
I have a plain ASCII file. When I try to open it with codecs.open(..., "utf-8"), I am unable to read single characters. ASCII is a subset of UTF-8, so...
(1) odpowiedzi
2017-09-26 19:09 Python: How come a large float turns into *inf* automatically? »
on Python 3.6.2, Win10-x64 Just something curious that I encountered and couldn't quite explain. In: x = 10.0 for i in range(10): print(str(i) ...
(2) odpowiedzi
2017-09-26 16:09 Populate selection field from Mysql with Odoo »
I want to populate a fields.Selection in Odoo with values retrieved from MySQL select statement. I tried adding the values of select resultset inside ...
(1) odpowiedzi
2017-09-26 14:09 Django custom for complex Func (sql function) »
In the process of finding a solution for Django ORM order by exact, I created a custom django Func: from django.db.models import Func class Position...
(2) odpowiedzi