Auto-sklearn installation error

I'm trying to install auto-sklearn using pip install auto-sklearn, but it raises the error: Command "/usr/bin/python3.5 -u -c " import setuptools, tokenize; __file__='/tmp/pip-build-tl8y2tfg/psutil/'; f=getattr(tokenize, 'open', ...
more »

2017-06-20 20:06 (0) Answers

Admin inline with no ForeignKey relation

Is it possible to manually specify the set of related object to show in an inline, where no foreign key relation exists? # Parent class Diary(models.Model): day = models.DateField() activities = models.TextField() # Child class Sleep(model...
more »

2017-06-20 09:06 (2) Answers

Default values for iterable unpacking

I've often been frustrated by the lack of flexibility in Python's iterable unpacking. Take the following example: a, b = range(2) Works fine. a contains 0 and b contains 1, just as expected. Now let's try this: a, b = range(1) Now, we get a Va...
more »

2017-06-18 20:06 (2) Answers

How to solve the circular import error in django?

I know the error is probably due to circular import error but not having much knowledge about it I am not able to correct it. I have tried using the methods given in similar questions but couldn't resolve it.The project has two apps consult and main ...
more »

2017-06-17 08:06 (2) Answers

How does numpy's fancy indexing work?

I was doing a little experimentation with 2D lists and numpy arrays. From this, I've raised 3 questions I'm quite curious to know the answer for. First, I initialised a 2D python list. >>> my_list = [[1, 2, 3], [4, 5, 6], [7, 8, 9]] I th...
more »

2017-06-15 20:06 (3) Answers

Comparing the speed of startswith() .vs. in()

I was under the impression that startswith has to be faster than in for the simple reason that in has to do more checks (allows for the word being looked for to be anywhere in the string). But I had my doubts so I decided to timeit. The code for the ...
more »

2017-06-13 13:06 (3) Answers

Django POST method in relational database model

I would like to create Object2 for defined user ID in url. GET method in the example shown below works fine, but I can't create POST method. I will be grateful for help. Let's assume I have free sample objects in database: User: id Object1: id user...
more »

2017-06-10 09:06 (1) Answers

Python variable assignment to a function

I've been messing around with an API for a trading website. I'm looking to reduce the amount of calls I have to make (via JSON) to the website so I figure I will assign the results of my call to a variable. My question is this: ETH_balance =
more »

2017-06-09 21:06 (1) Answers

Can I access class variables using self?

I have a class Foo with a class variable remote. Can I access the class variable remote using self.remote? class Foo: remote = False def __init__(self): self.remote = True @classmethod def print_remote(cls): print(
more »

2017-06-09 16:06 (3) Answers

Connect refused in response to Django runserver

Working my way through a Django tutorial, I have run django-admin startproject mysite. Now I cannot get the next step to work. $ python runserver >>> $ where the blank line is where Ctrl-C was entered to break the loop. The &...
more »

2017-06-08 21:06 (1) Answers

Python3 how to save dict to a file

hi guys im new to python(3) i know this question is already answerd i searched on stackoveflow google... but i cant seems to understand it pls help me this is my code EDIT i've updated my code a litle bit EDITED LAST 4 LINES import pickle ...
more »

2017-06-04 12:06 (0) Answers

Creating lists of variable length from one list

I want to create a number of lists from a single list. The lists will either have 1 value or 3 based on if there is data from a user. However, since the data is attached to a specific user, the order must be maintained. For example: data = ['no d...
more »

2017-06-04 01:06 (2) Answers