Data dodania Pytanie
2017-09-17 22:09 Structuring Django Project »
I know that you're supposed to have a templates folder within each app folder, how I have two questions clarify further. 1, Should I have 2 base.html ...
(1) odpowiedzi
2017-09-17 20:09 How do I pass a dictionary from one view to another in Django using session? »
I have used session to pass dict from one view to another. But it shows this error. I want to create multiple templates submit form. my views.py d...
(2) odpowiedzi
2017-09-17 19:09 Extracting and transforming data in numpy »
Suppose I have the following numpy vector [[1, 3., 'John Doe', 'male', 'doc', '25'], ..., [9, 6., 'Jane Doe', 'female', 'p', '28']] I need to ex...
(1) odpowiedzi
2017-09-17 19:09 How do I configure pip inside a virtualenv to install packages to the current directory root? »
I'm using the serverless framework with AWS Lambda. When using pip.conf with pip3.6, I'd like to set the "target-dir" to the 'current directory'. Set...
(1) odpowiedzi
2017-09-17 16:09 eventlet.monkey_patch() throws an exception: The SECRET_KEY setting must not be empty »
I have a Django project. The packages I use: Django 1.11, Eventlet 0.21.0. Python version is 3.4.3. There are the following configuration files: 1) T...
(2) odpowiedzi
2017-09-17 16:09 How do you pass json to a parameterized sql statement using psycopg2? »
What's the correct syntax to pass json into a parameterized SQL statement? How do you safely pass a variable into the json along with it? I ha...
(0) odpowiedzi
2017-09-17 15:09 Embedded python issue »
I am new to Python and embedded python altogether. When trying to run some basic python commands from C++, It seems that some of my imports do not wo...
(0) odpowiedzi
2017-09-17 09:09 Elegant way to complete a parallel operation on two arrays of unequal lengths »
I want to write a function in numba that runs a math operation on 2 arrays, and accommodate for when both arrays don't have the same element count. S...
(2) odpowiedzi
2017-09-17 05:09 How to remove all the values in a string except for the chosen ones »
So my code is value = "123456" I want to remove everything except for 2 and 5. the output will be 25 the program should work even the value is chang...
(6) odpowiedzi
2017-09-16 22:09 Cannot include urls from my app in django »
I am following the TDD web development with Python to learn Django. It is based on Django 1.8 but I am trying to follow it on Django 1.11. There seem ...
(2) odpowiedzi
2017-09-16 18:09 Bin elements per row - Vectorized 2D Bincount for NumPy »
I have a NumPy array with integer values. Values of matrix range from 0 to max element in matrix(in other words, all numbers from 0 to max data elemen...
(1) odpowiedzi
2017-09-16 14:09 Multiprocessing pool: How to call an arbitrary list of methods on a list of class objects »
A cleaned up version of the code including the solution to the problem (thanks @JohanL!) can be found as a Gist on GitHub. The following code snipp...
(1) odpowiedzi
2017-09-16 11:09 Split a list into other sublists, splitting will be based on a space defined in the main list »
Let say I have this list: list1 = ["I", "am", "happy", " ", "and", "fine", " ", "and", "good"] I want to end up with: sublist1 = ["I", "am", "happ...
(6) odpowiedzi
2017-09-16 10:09 How can i call a html template without any view in django »
I want to call index.html template to particular URL without calling any view. is it possible in django? ...
(1) odpowiedzi
2017-09-16 09:09 staircase "#" program in python, correct output but not qualifying default test cases »
Write a program that prints a staircase of size . Input Format: A single integer, n, denoting the size of the staircase. Output Format: Print a stai...
(3) odpowiedzi
2017-09-16 04:09 How do I make a list comparison be case insensitive? »
current_ids = ['mason' , 'chase' , 'erin' , 'guillermo' , 'george'] new_ids = ['sara' , 'gregory' , 'ChaSe' , 'josh' , 'Erin'] for new in new_ids: ...
(1) odpowiedzi
2017-09-16 02:09 How to integrate or convert Python script to be used in Chrome Extension »
I am working on a chrome extension which generates a meme, given a selected text. The intended functionality is to select some string of text, open a ...
(0) odpowiedzi
2017-09-15 21:09 Extract IPs and Ports from a list in Python 3.x »
I would like to extract an IP and Port from a returned list. I am currently using str(var).replace command to remove extra characters. This will/has c...
(4) odpowiedzi
2017-09-15 15:09 Iterating through json list in Django template »
I am passing the following context in my Django template : context = {'test': custom_json_list} And the output of custom_json_list is this : {'p...
(1) odpowiedzi
2017-09-15 12:09 Inheritance of class variables in python »
Trying to understand oop in python I came into this situation that puzzles me, and I wasn't able to find a satisfactory explanation... I was building...
(1) odpowiedzi
2017-09-15 12:09 Splitting list of dictionary into sublists after the occurence of particular key of dictionary »
I have list of dictionaries. These dictionaries basically have just one key-value each. For example: lst = [{'x': 23}, {'y': 23432}, {'z': 78451}, ...
(5) odpowiedzi
2017-09-15 01:09 Django template Module Import Error »
Using Django version 1.9.5 and Python 3. Upon navigation to the url, I am getting the following error: ImportError at /music/ No module named 'djan...
(2) odpowiedzi
2017-09-15 00:09 Why is this python class instance hashable? »
This is pertaining to python 2.x In the following class, if we subclass "object", I understand the methods are inherited in the derived class Foo whi...
(1) odpowiedzi
2017-09-14 19:09 What is assigned to `variable`, in `with expression as variable`? »
From Learning Python: The basic format of the with statement looks like this, with an optional part in square brackets here: with expression [a...
(2) odpowiedzi
2017-09-14 17:09 Why do different variable names get different results(python2.7)? »
in this code: results = [] for i in [1, 2, 3, 4]: def inner(y): return i results.append(inner) for i in results: print i(None)...
(3) odpowiedzi
2017-09-14 02:09 How to tell if any element in a list of combinations is in a specific set in the most efficient way? »
here is what i mean by the question: j = [1,2,3,4,5,6,7] k = [1,2,3,4,5,6,7] #I want to generate all possible pairs of pairs with these two lists, f...
(0) odpowiedzi
2017-09-14 00:09 Filtering pandas dataframe with multiple boolean columns »
I am trying to filter a df using several boolean variables that are a part of the df. But have been unable to do so. Sample data: A | B | C | D Joh...
(3) odpowiedzi
2017-09-13 22:09 Django on mod_wsgi syntaxError »
I installed Django 1.11.5 with Virtualenv on mod_wsgi. python version is 2.7.13. I get this error in /var/log/httpd/error_log: [Wed Sep 13 16:41:00...
(0) odpowiedzi
2017-09-13 21:09 Django - access class attributes of a class-based view in middleware »
I have a couple of views and each of them must be accesed by no more than one user at a time. Therefore I use a locking service for this. My idea is a...
(1) odpowiedzi
2017-09-13 20:09 How to handle variable sized input in CNN with Keras? »
I am trying to perform the usual classification on the MNIST database but with randomly cropped digits. Images are cropped the following way : remove...
(2) odpowiedzi
2017-09-13 14:09 How to properly tag corrupted datalines in dataframe after an error has been raised in Python »
I have a large dataframe containing, amongst other things, a (Norwegian) social security number. It is possible to get the date of birth out of this n...
(2) odpowiedzi
2017-09-13 01:09 Cannot assign to list comprehension? »
I have been coding a game for a school assessment so excuse the basic code. My issue is that I am getting an error saying SyntaxError: can't assign to...
(1) odpowiedzi
2017-09-13 00:09 How can I map the headers to columns in pandas? »
I have a dataframe like : A B C 1 0 0 1 1 0 0 1 0 0 0 1 I want to have : A B C label 1 0 0 A 1 ...
(5) odpowiedzi
2017-09-12 21:09 Update page content from live PHP and Python output using Ajax »
Long-time user, first-time asker. I've learned so much from the community and I love this site. So here is what I'm shooting for. I want to have a w...
(3) odpowiedzi
2017-09-12 21:09 How to reverse_lazy to a view/url with variable? »
I've got a DeleteView I use for removing objects from a model. It is launched via a button in a table. It works fine. class DeleteAssignment(DeleteVi...
(2) odpowiedzi