Data dodania Pytanie
2017-01-07 08:01 Problems with Newlines using django on a Windows Server in France »
Problem: My Django app is introducing a CR before each CRLF when writing to a file a string which has been read in via render_to_string. In my templat...
(1) odpowiedzi
2017-01-06 23:01 Python: Find largest array index along a specific dimension which is greater than a threshold »
Lets say I have a 4-D numpy array (ex: np.rand((x,y,z,t))) of data with dimensions corresponding to X,Y,Z, and time. For each X and Y point, and at e...
(2) odpowiedzi
2017-01-06 22:01 PyCharm is changing the default encoding in my Django app »
I am running into an issue where plyplus is erroring out with: File "/Users/FOO/.virtualenvs/ff/lib/python2.7/site-packages/plyplus/grammars/__init...
(1) odpowiedzi
2017-01-06 20:01 Overiding __mul__ in two dimensional vector class to preserve commutivity »
I have defined the following class: class Point(object): def __repr__(self): return "("+str(self.x)+","+str(self.y)+")" def __init_...
(2) odpowiedzi
2017-01-06 18:01 Python overwriting variable in script 1 with user input from script2 »
I've been struggling with this for several days now, and I cant find any answers that actually relate to what I'm trying to do, at least none that I c...
(1) odpowiedzi
2017-01-06 15:01 Run python 2.7 inside python 3x virtualenv »
I have a python 3.5x virtualenv, I have some older python 2.7 scripts I'd like to run inside this python 3.5x virtualenv, but obviously the two enviro...
(0) odpowiedzi
2017-01-06 13:01 How to automatically change model fields in django »
I have a model and I want to know if it is possible to set a condition that triggers a change in the model field. For example, I have a model class B...
(2) odpowiedzi
2017-01-06 12:01 Find the number of characters in a file using Python »
Here is the question: I have a file with these words: hey how are you I am fine and you Yes I am fine And it is asked to find the number of words,...
(12) odpowiedzi
2017-01-06 10:01 Migration of Django field with default value to PostgreSQL database »
https://docs.djangoproject.com/en/1.10/topics/migrations/ Here it says: "PostgreSQL is the most capable of all the databases here in terms of schema ...
(2) odpowiedzi
2017-01-06 10:01 Using Single Celery Server For Multi Django Projects »
I have 3 Separate Django Projects sharing same DB running on the same Machine. What I require is to configure Celery For them. Now my question is: 1....
(1) odpowiedzi
2017-01-06 09:01 How to insert dictionaries as last rows in Pandas DataFrame »
I have the following dataframe: import pandas as pd df = pd.DataFrame({'id':['a','b','c','d','e'], 'Sample1':[-14,-90,-90,-96,-91]...
(3) odpowiedzi
2017-01-06 08:01 How to pass a list as a function's arguments »
If I have a function: def run(time, message, time_span_pattern): ... And a list like: run_args = ['1s', '1 second alarm', <_sre.SRE_Pattern...
(1) odpowiedzi
2017-01-05 20:01 ZipFile.testzip() returning different results on Python 2 and Python 3 »
Using the zipfile module to unzip a large data file in Python works correctly on Python 2 but produces the following error on Python 3.6.0: BadZipFil...
(3) odpowiedzi
2017-01-05 18:01 Oscillating processing speed in a python script using pysam.TabixFile to annotate reads »
The initial question I'm writing a bioinformatics script in python (3.5) that parses a large (sorted and indexed) bam file representing sequencing re...
(0) odpowiedzi
2017-01-05 16:01 How to use kwarg arguments when evaluating a function using map functionality »
Below is an example of a test method which is evaluated using a for loop and a kwarg argument. def test(first_arg='_', second_arg='_'): return 'f...
(1) odpowiedzi
2017-01-05 13:01 What is the correct way of doing Django imports ? »
I would like to understand if the there is a correct and accepted way of handling imports in Django? I use following patterns > # import views from...
(1) odpowiedzi
2017-01-05 13:01 About property class in a python »
I saw a python snippet as below when seeking for a tutorial to property in python: class Celsius: def __init__(self, temperature = 0): se...
(2) odpowiedzi
2017-01-05 08:01 Issue with Sqlalchemy and inserting array of jsonb to postgresql »
So i'm trying to insert an array of jsonb values into my database but I can't seem to format it right, here's my code: updated_old_passwords.append({...
(0) odpowiedzi
2017-01-05 07:01 push_back/emplace_back a shallow copy of an object into another vector »
Say I have the following code class Car { public: string color; string name; Car(string c, string n): color(c), name(n){}...
(4) odpowiedzi
2017-01-05 07:01 using heap helps boost performance for string rearrange »
I'm working on the problem below and have posted my code. My question is, my current implementation is using a sort in Python - sorted(sorted_freq, re...
(1) odpowiedzi
2017-01-05 05:01 Django inspectdb skips tables with constraints »
I read a few topics on this, but none really seemed to offer a solution in inspectdb, or an alternative, that permits Django to make models for an exi...
(0) odpowiedzi
2017-01-05 00:01 Why does list ask about __len__? »
class Foo: def __getitem__(self, item): print('getitem', item) if item == 6: raise IndexError return item**2 ...
(2) odpowiedzi
2017-01-04 21:01 multi nested dictionary from tuples in python »
I have this list of tuples list_of_tuples = [('0', '1'), ('1', '1.1'), ('1', '1.2'), ('1', '1.3'), ('1', '1.4'), ('0', '3'), ('3', '3.1'), ('3', '3.2...
(2) odpowiedzi
2017-01-04 16:01 How to override queryset count() method in Django's admin list »
In order to avoid time consuming and costly exact database count queries, I'd like to override the count() method inside a Django admin class like so:...
(2) odpowiedzi
2017-01-04 15:01 How to filter queryset by ForeignKey and ManyToMany using Q properly? »
I got an error message that says: 'User' object does not support indexing I try to filter queryset using Q to get a query that contains objects ...
(1) odpowiedzi
2017-01-04 13:01 Identify clusters linked by delta to the left and different delta to the right »
Consider the sorted array a: a = np.array([0, 2, 3, 4, 5, 10, 11, 11, 14, 19, 20, 20]) If I specified left and right deltas, delta_left, delta_rig...
(1) odpowiedzi
2017-01-04 12:01 Finding the extent of a matplotlib plot (including ticklabels) in axis coordinates »
I need to find the extent of a plot including its related artists (in this case just ticks and ticklabels) in axis coordinates (as defined in the matp...
(1) odpowiedzi
2017-01-04 02:01 How to allow users to dynamically set the scheduled time for email reports within a web framework? »
Right now, I am using crontab to send out scheduled emails. The way I have been doing it is using a web framework like Django, CakePHP, or Laravel, a...
(1) odpowiedzi
2017-01-03 22:01 Average face - algorithm »
Quesion and code is at the end I hope this question belongs here and not to the TCS's stack. I am trying to go through algorithms in Turk and Pentland...
(1) odpowiedzi
2017-01-03 19:01 Elegant way to delete single key of from each element in iterable »
Is it possible to manipulate each dictionary in iterable with lambdas? To be clarify, just want to delete _id key from each element. Wonder If there...
(2) odpowiedzi
2017-01-03 19:01 Django url warning urls.W002 »
Sorry in advance if this question look a bit superfluous but is something that is really bothering me. I have a set of API's written in Django defin...
(3) odpowiedzi
2017-01-03 17:01 Attempting to update the module beautifulsoup4 yields the error AttributeError: 'list_iterator' object has no attribute 'next' »
I somehow broke Spyder within Anaconda and couldn not even get it running again (some issue with connecting to the C library) so I uninstalled/deleted...
(0) odpowiedzi
2017-01-03 16:01 What is the difference between i = i + 1 and i += 1 in a 'for' loop? »
I found out a curious thing today and was wondering if somebody could shed some light into what the difference is here? import numpy as np A = np.ar...
(6) odpowiedzi
2017-01-03 14:01 Why is regex search slower with capturing groups in Python? »
I have an application code which generates regexes dynamically from a config for some parsing. When timing performance of two variations, the regex va...
(2) odpowiedzi
2017-01-02 18:01 Python list error: [::-1] step on [:-1] slice »
I thought I understood the basics of list slicing in python, but have been receiving an unexpected error while using a negative step on a slice, as fo...
(5) odpowiedzi