Data dodania Pytanie
2017-04-18 00:04 Python2 datetime - Convert epoch time to UTC timestamp with offset »
I am using Python 2 due to reasons beyond my control and hence cannot upgrade to Python 3 (which has better support for timezones). I have an epoch t...
(2) odpowiedzi
2017-04-17 20:04 Python default params confusion »
I just started learning Python and I'm confused about this example: def append_to(element, to=None): if to is None: to = [] to.append...
(3) odpowiedzi
2017-04-17 20:04 Django implementation of default value in database »
I had a field on a model with was: class SomeModel(models.Model): some_field = models.CharField(max_length=10, null=True, blank=True) Then I ch...
(1) odpowiedzi
2017-04-17 16:04 Numpy dot too clever about symmetric multiplications »
Anybody know about documentation for this behaviour? import numpy as np A = np.random.uniform(0,1,(10,5)) w = np.ones(5) Aw = A*w Sym1 = Aw.dot(Aw....
(2) odpowiedzi
2017-04-17 15:04 Recursive function keeps turning infinitely python »
I am trying to write some code to solve this math problem: there is 8 teams and all of them will play football game each other (so total of 7+6+...+1 ...
(1) odpowiedzi
2017-04-17 11:04 Python Facebook SDK Exended Access Token for App doesn't diplay all the Fields »
I am new to Python and Facebook-Graph API. I studied about it and successfully used the Facebook-Python SDK. First of all i got an access token from...
(0) odpowiedzi
2017-04-17 03:04 No supported color terminal library Python/Jupyter »
I'm trying to start a Jupyter Notebook server on my Windows 7 machine, but I keep getting this odd, seemingly unsearchable error after typing: jupyte...
(4) odpowiedzi
2017-04-16 23:04 Pandas: Count Distinct Combinations of two columns and add to Same Dataframe »
Need help in adding the unique combination of two columns to the same dataframe in pandas. I want that "nos" column. Input: id acct_nos name 1 1a ...
(2) odpowiedzi
2017-04-16 22:04 Python: How to take multiple lines of inputed data and put it into a list »
I know this is probably something incredibly simple, but I seem to be stumped. Anyways for an assignment I have to have the user enter the number of d...
(3) odpowiedzi
2017-04-16 18:04 Recursive Statement Errror »
Alright So I seem to be having an issue somewhere in my main function . I am able to input both Base and Exponent yet, When It moves onto the next fun...
(1) odpowiedzi
2017-04-16 16:04 How to vectorize Softmax probability of a multi dimensional matrix »
I am trying to go through the assignment 1 for Stanford cs244n class. Problem 1b highly recommend optimization for the Softmax function. I managed to ...
(2) odpowiedzi
2017-04-16 15:04 Django - HTTP and WebSockets »
We have an existing large Django 1.11 & Django-rest-framework application served by wsgi. We noticed that we might want to use a WebSocker for som...
(0) odpowiedzi
2017-04-16 01:04 if/else statements vs dictionary »
If I were to write a statement using dictionary instead of an else statement, how would that be? For example, say I have def determineRank(years): ...
(3) odpowiedzi
2017-04-15 20:04 How to implement a simple greedy multiset based algorithm in python »
I would like to implement the following algorithm. For n and k, consider all combinations with repetitions in sorted order where we choose k numbers f...
(1) odpowiedzi
2017-04-15 19:04 How can I add a facebook user login functionality »
My python version is 3.4.3 and my django version is 1.9.6 . I tried many django facebook registrations apps but almost all the versions are outdated....
(3) odpowiedzi
2017-04-15 17:04 Java code execution time issue »
I have the following code modeling a lightweight framework for a vertex in my study of network diffusion. The initial prototype was from a framework i...
(1) odpowiedzi
2017-04-15 12:04 How to make a text file into a list of arrays (array-in-array) and remove spaces/newlines »
For example I have a txt file: 3 2 7 4 1 8 9 3 6 5 4 1 1 0 8 7 On every line there are 4 numbers and there are 4 lines. At end of lines there's \n ...
(3) odpowiedzi
2017-04-15 12:04 How To Pagination Angular2 with Django Rest Framework API »
I am trying to create a simple blog application using Angular2 with Django Rest Framework. I am implementing pagination in Django, but I do not know h...
(0) odpowiedzi
2017-04-15 09:04 why is blindly using df.copy() a bad idea to fix the SettingWithCopyWarning »
There are countless questions about the dreaded SettingWithCopyWarning I've got a good handle on how it comes about. (Notice I said good, not great) ...
(2) odpowiedzi
2017-04-14 23:04 Celery beat sometimes stops working »
I'm using latest stable Celery (4) with RabbitMQ within my Django project. RabbitMQ is running on separate server within local network. And beat peri...
(1) odpowiedzi
2017-04-14 20:04 How to set up urls in django when there are multiple apps within the same project? »
I am new to django. I am trying to setup the URLs. I have 2 apps under a project 'mysite'. In the urls.py for mysite, I have included the urls from...
(2) odpowiedzi
2017-04-14 16:04 Opposite of __init__ in thread class »
I understand that __init__() is called automatically when you create a class like newThread = MyThread(property) and run() is triggered by newthread.s...
(3) odpowiedzi
2017-04-14 15:04 python ntlk donwload gives parser eror »
I am trying to run the following command import nltk nltk.download('all') But I am getting this error Traceback (most recent call last): File "...
(2) odpowiedzi
2017-04-14 14:04 Given a text count occurrences of all two consecutive words »
Input: Once upon a time a time this upon a Output: dictionary { 'Once upon': 1, 'upon a': 2, 'a time': 2, 'time a': 1, ...
(3) odpowiedzi
2017-04-14 13:04 Django csrf token missing or incorrect error 403 »
When i submit the form i get following error: CSRF verification failed Reason given for failure: CSRF token missing or incorrect. my vie...
(2) odpowiedzi
2017-04-14 11:04 More Elegant way to number a list according to values »
I would like to map a list into numbers according to the values. For example: ['aa', 'b', 'b', 'c', 'aa', 'b', 'a'] -> [0, 1, 1, 2, 0, 1, 3] I'...
(5) odpowiedzi
2017-04-14 10:04 2sum performance improvement »
The file contains 1 million integers, both positive and negative (there might be some repetitions!).This is your array of integers, with the ith row o...
(1) odpowiedzi
2017-04-13 23:04 Writing a python method that refers to both the instance and the class »
Let's say we have a Pet class in Python: class Pet(object): num_pets = 0 def __init__(self, name): self.name = name Pet.num_...
(3) odpowiedzi
2017-04-13 17:04 Whitespace in the path of Windows filepath getting WindowsError: [Error 2] »
I am getting the error shown below. It looks like a path issue because of space. >>> from _winreg import * >>> aReg = ConnectRegist...
(0) odpowiedzi
2017-04-13 13:04 Does Python optimize away a variable that's only used as a return value? »
Is there any ultimate difference between the following two code snippets? The first assigns a value to a variable in a function and then returns that ...
(2) odpowiedzi
2017-04-13 13:04 How to set the value of a model field by performing an equation between other model fields »
I want to set the value of a model field by performing an equation between other model fields. Here's my model: class Current(models.Model): time...
(1) odpowiedzi
2017-04-13 12:04 How can I split a string of a mathematical expressions in python? »
I made a program which convert infix to postfix in python. The problem is when I introduce the arguments. If i introduce something like this: (this wi...
(8) odpowiedzi
2017-04-13 09:04 Is it possible run makemigrations with deleted schema? »
My all SQL schema was deleted cause of windows10 initialization. So, I wanna run makemigrations with already existing django project code(with so many...
(1) odpowiedzi
2017-04-13 09:04 how to find file extension in case of file list? »
How can i find extension of list of files .I am currently using os.path.splitext which is not working.Please suggest any other method in case of file ...
(1) odpowiedzi
2017-04-13 03:04 Print a postgresql table to standard output in python »
I have a table in postgresql named mytable and I need to print the contents of this table from a python application to stdout. I'm currently doing th...
(2) odpowiedzi