Data dodania Pytanie
2018-02-19 17:02 Algorithm to find the most repetitive (not the most common) sequence in a string (aka tandem repeats) »
I am looking for an algorithm (possibly implemented in Python) able to find the most REPETITIVE sequence in a string. Where for REPETITIVE, I mean any...
(3) odpowiedzi
2018-02-19 16:02 How to use the IF ALL statement in Python »
I have a function named checker(nums) that has an argument that will later receive a list. What i want to do with that list is to check if each other ...
(3) odpowiedzi
2018-02-19 15:02 Django 2 url path matching negative value »
In Django <2 the normal way of doing this is to use regex expression. But it is now recommended in Django => 2 to use path() instead of url() path...
(1) odpowiedzi
2018-02-19 13:02 Ensure that a path to a dir is a Django project »
For the last two days I am struggling with the following question: Given an absolute path (string) to a directory (inside my file system or the serve...
(2) odpowiedzi
2018-02-19 12:02 Pythonic reduce with accumlation and arbitrary lambda function? »
What would be the Pythonic way of performing a reduce with accumulation? For example, take R's Reduce(). Given a list and an arbitrary lambda functio...
(1) odpowiedzi
2018-02-19 11:02 How to use jsonb - and #- to delete in sqlalchemy »
I have a jsonb column named "randomblocks" in my postgres database table "blocks" having data similar to the json: { "block": { "1": { "c...
(0) odpowiedzi
2018-02-19 10:02 Pandas storing the date values in wrong column »
I am trying to process the future values: last_date = df.iloc[-1] print(last_date) last_unix = last_date.Timestamp # one_day = 86400 one_minute = 6...
(1) odpowiedzi
2018-02-19 09:02 Perceptron learning algorithm doesn't work »
I'm writing a perceptron learning algorithm on simulated data. However the program runs into infinite loop and weight tends to be very large. What sho...
(3) odpowiedzi
2018-02-19 09:02 Subprocess or import to invoke a script in Python »
I have a script task.py that I am trying to invoke. It seems there are two ways to do that. One is to use the subprocess API while the other is to use...
(2) odpowiedzi
2018-02-19 03:02 Deleting selected rows in DataTable and Django »
I've made a selectable rows checkbox using DataTables. I have created a good UpdateView for this so far, so editing items are good. How can I do some...
(1) odpowiedzi
2018-02-18 23:02 How can I store multiple function as a value of the dictionary? »
In the following code I try to store multiple functions as a value of the dictionary. This code doesn't work. The two functions are returned as a tupl...
(1) odpowiedzi
2018-02-18 13:02 Market Basket Analysis »
I have the following pandas dataset of transactions, regarding a retail shop: print(df) product Date Assistant_name product_...
(2) odpowiedzi
2018-02-18 12:02 Images are not displayed on web-page (Django) »
the problem is this, using Bootstrap 3, created the "Carousel" from the images, then in Views wrote a loop that adds all the images with paths to the ...
(1) odpowiedzi
2018-02-18 09:02 how to convert pandas data with strings as rows to each words in that strings as rows in same column? »
how to convert pandas data with strings as rows to each words in that strings as rows in same column? Eg: 0 I love python 1 I hate programming to ...
(3) odpowiedzi
2018-02-17 22:02 Add CSRF token to hard coded Django form »
I am building a static page with Jekyll that has a hard coded form, I am sending the form data to a Django server, I am having trouble generating a CS...
(3) odpowiedzi
2018-02-17 20:02 translating compose functions from javascript to python, the functional way »
I'm trying to translate my Javascript compose functions into Python but I'm having trouble with the last one. How can I generalize an unknown number o...
(2) odpowiedzi
2018-02-17 20:02 How to randomise the order of a queryset »
Consider the following query: candidates = Candidate.objects.filter(ElectionID=ElectionIDx) Objects in this query are ordered by their id field. Ho...
(1) odpowiedzi
2018-02-17 10:02 Why is time complexity O(1) for pow(x,y) while it is O(n) for x**y? »
Why is time complexity O(1) of pow(x,y) while it is O(n) for x ** y? Check comment from agf here ...
(1) odpowiedzi
2018-02-17 04:02 Count each group sequentially pandas »
I have a df that I am grouping by two columns. I want to count each group sequentially. The code below counts each row within a group sequentially. Th...
(3) odpowiedzi
2018-02-17 01:02 How to add a table in django app models from PostgreSQL? »
I have created a django project named Book Store. In my project I have one app named books. I am using PostgreSQL DBMS. I have a database called book...
(1) odpowiedzi
2018-02-17 00:02 .join() function not working in Python »
I was wondering if someone could help me figure out why my few lines of code isn't working in Python. I am trying to create my own version of the Batt...
(4) odpowiedzi
2018-02-16 23:02 Regex using increasing sequence of numbers Python »
Say I have a string: teststring = "1.3 Hello how are you 1.4 I am fine, thanks 1.2 Hi There 1.5 Great!" That I would like as: testlist = ["1.3 H...
(3) odpowiedzi
2018-02-16 18:02 Django: how to fully decouple apps when it seems they are coupled? »
Note: I am not a proper python programmer... but I use python extensively. I do things like write classes with inheritance, use iterators and comprehe...
(0) odpowiedzi
2018-02-16 16:02 Ordering a list of tuples by equality of the 1st element of one tuple and the 2nd element of another tuple »
I have a list of tuples representing points (x, y) and want to order them such that if x_i of a point p_i is equal to y_j of another point p_j. The po...
(4) odpowiedzi
2018-02-16 15:02 is there a better way to set global variables in a script »
I've written a function in another file, basically doLostOfStuff and to call, it, I have my main.py file pass variables to it. Something like this d...
(1) odpowiedzi
2018-02-16 14:02 Add 'auto_now' DateTimeField to existing Django model »
Is it possible to add to existing model auto_now and auto_now_add DateTime fields? class ExistingModel(models.Model): # ... model stuff creat...
(1) odpowiedzi
2018-02-16 14:02 Can I access a nested dict with a list of keys? »
I would like to access a dictionary programmatically. I know how to do this with a recursive function, but is there a simpler way? example = {'a': {'...
(5) odpowiedzi
2018-02-16 13:02 how to get useful data from xhr responses in facebook page? »
I am trying to web scrape my facebook page to get the birthdays of all my friends. Since facebook uses ajax calls to load the friends names in the "bi...
(2) odpowiedzi
2018-02-16 08:02 Worker on Python2, and client on Python3 in Celery »
I'm trying to have the worker run on Python2, and client on Python3. I notice that if I launch client from Python3, the worker code too seems to run o...
(0) odpowiedzi
2018-02-16 03:02 Quickly check large database for edit-distance similarity »
I have a database of 350,000 strings with an average length of about 500. The strings are not made up of words, they are an essentially random assortm...
(1) odpowiedzi
2018-02-16 01:02 Identify Items In Array that are Out of Order in Python »
Is there an easy way in Python to identify items that are out of order in lists like these two examples: data1 = [[0,100],[120,130],[2,4],[3000,3400]...
(0) odpowiedzi
2018-02-15 17:02 Does overriding an abstract base class attribute affect other child classes? »
If I change the attribute of an abstract base class field like Classname._meta.get_field(fieldname).attribute = 'value' will it affect the other ch...
(1) odpowiedzi
2018-02-15 15:02 `del` on a package has some kind of memory »
del seems to have some memory which puzzles me. See the following: In [1]: import math In [2]: math.cos(0) Out[2]: 1.0 In [3]: del math.cos In [4]...
(3) odpowiedzi
2018-02-15 12:02 Getting Permissions issue on sending the authenticated request to OAuth2.0 Django rest Framwork »
I Have integrated the OAuth2.0 with django-rest-framework. When I send the authenticated request to my class based view I got this { "detail": "...
(1) odpowiedzi
2018-02-15 11:02 Compute the cumulative sum of a list until a zero appears »
I have a (long) list in which zeros and ones appear at random: list_a = [1, 1, 1, 0, 1, 1, 0, 1, 0, 1, 1, 1] I want to get the list_b sum of the ...
(6) odpowiedzi