Data dodania Pytanie
2017-02-08 10:02 Extract text with multiple separators »
I have list of strings with separators A and B: L = ['sgfgfqds A aaa','sderas B ffff','eeee','sdsdfd A rrr'] and need: L1 = [['aaa'], ['ffff'], ['...
(5) odpowiedzi
2017-02-08 08:02 Why is copying a shuffled list much slower? »
Copying a shuffled range(10**6) list ten times takes me about 0.18 seconds: (these are five runs) 0.175597017661 0.173731403198 0.178601711594 0.1803...
(3) odpowiedzi
2017-02-08 05:02 How do I get django-debug-toolbar to only display on my ip address hosted on python anywhere? »
I am trying to use django-debug-toolbar on python anywhere in a django app. It requires me to set my ip address in the settings which i've done, but ...
(1) odpowiedzi
2017-02-08 03:02 Benefit of using logging over print() to log information to Papertrail in a Django Heroku app »
I have a Django app that I'm hosting on Heroku and logging to Papertrail via the Papertrail Heroku add-on. There are numerous places where I'm logging...
(1) odpowiedzi
2017-02-07 20:02 Numpy 2D array: change all values to the right of NaNs »
Situation I have a 2D Numpy array that contains some nan values. Simplified example: arr = np.array([[3, 5, np.nan, 2, 4], [9, 1, 3,...
(2) odpowiedzi
2017-02-07 19:02 Can I import Python's 3.6's formatted string literals (f-strings) »
The new Python 3.6 f-strings seem like a huge jump in string usability to me, and I would love to jump in and adopt them whole heartedly on new projec...
(2) odpowiedzi
2017-02-07 19:02 How does Apache Spark send functions to other machines under the hood »
I started playing with Pyspark to do some data processing. It was interesting to me that I could do something like rdd.map(lambda x : (x['somekey'],...
(2) odpowiedzi
2017-02-07 18:02 Accurately testing Pypy vs CPython performance »
The Problem Description: I have this custom "checksum" function: NORMALIZER = 0x10000 def get_checksum(part1, part2, salt="trailing"): """Retu...
(0) odpowiedzi
2017-02-07 17:02 Python: Map a function over recursive iterables »
I have an arbitrarily nested iterable like so: numbers = (1, 2, (3, (4, 5)), 7) and I'd like to map a function over it without changing the structu...
(2) odpowiedzi
2017-02-07 17:02 Saving a local datetime offset the time by 4 minutes »
I'm trying to modify a datetime based on a timezone on save and on load the following way: An input datetime, along with a input timezone are sent to...
(1) odpowiedzi
2017-02-07 12:02 Order a dictionary based on specific values »
Before writing a function, I would like to be sure there is no pre-built (optimized) solution (like sorted()) that can: From a dictionary like this o...
(2) odpowiedzi
2017-02-07 00:02 Django skips particular migration(No Migrations to apply) »
I am working on an app at Django 1.9 I created altered one field from User model (max_length to 120 from 40). I know the migration has not run and i ...
(1) odpowiedzi
2017-02-06 21:02 Delete newline at end of for loop -- python 2.x »
I have been doing exercises on codeabbey.com to brush the rust off, and I keep running into this small, but still frustrating problem. I want my progr...
(1) odpowiedzi
2017-02-06 19:02 python concurrent.futures.ProcessPoolExecutor: Performance of .submit() vs .map() »
I am using concurrent.futures.ProcessPoolExecutor to find the occurrence of a number from a number range. The intent is to investigate the amount of s...
(2) odpowiedzi
2017-02-06 17:02 How to connect Django Rest Framework with contrib.auth views »
I am using DRF with JWT (JSON Web Token) authentication. I want to use django's built-in reset password functionality. So, I have included the urls: ...
(1) odpowiedzi
2017-02-06 16:02 Divide list to multiple lists based on elements value »
I have the following list: initial_list = [['B', 'D', 'A', 'C', 'E']] On each element of the list I apply a function and put the results in a dicti...
(5) odpowiedzi
2017-02-06 16:02 Numpy argmax - random tie breaking »
In numpy.argmax function, tie breaking between multiple max elements is so that the first element is returned. Is there a functionality for randomizin...
(1) odpowiedzi
2017-02-06 14:02 Python: What libraries are 'standard libraries'? »
I am reading PEP 8, and in the imports section it says to put 'standard library imports' in the top of your library import section. My question is: Ho...
(1) odpowiedzi
2017-02-06 13:02 VS Code: How to auto refresh Pylint »
I wan't the Pylint style suggestions to automatically update in VS code. E.g. if there is a style error, and I fix it I wan't it to automatically upda...
(0) odpowiedzi
2017-02-06 13:02 Django cannot import settings »
I'm trying to use django-admin dbshell (any other cmd gives the same result) on my project. And I got You must either define the environment variabl...
(2) odpowiedzi
2017-02-06 07:02 How to do group by and take count of unique and count of some value as aggregate on same column in python pandas? »
My question is related to my previous Question but it's different. So I am asking the new question. In above question see the answer of @jezrael. df...
(2) odpowiedzi
2017-02-06 03:02 Concatenate tuples using sum() »
From this post I learned that you can concatenate tuples with: >>> tuples = (('hello',), ('these', 'are'), ('my', 'tuples!')) >>> s...
(2) odpowiedzi
2017-02-05 23:02 Creating a "bitmask" from several boolean numpy arrays »
I'm trying to convert several masks (boolean arrays) to a bitmask with numpy, while that in theory works I feel that I'm doing too many operations. F...
(3) odpowiedzi
2017-02-05 23:02 Make Celery use Django's test database without task_always_eager »
When running tests in Django applications that make use of Celery tasks I can't fully test tasks that need to get data from the database since they do...
(1) odpowiedzi
2017-02-05 11:02 Count all past occurences of an element in a large dataset »
I have a quite large dataframe (3 million rows) that looks like this: df = pd.DataFrame({'user_id' : ['100','101','102','103','104'], 'ser...
(2) odpowiedzi
2017-02-05 10:02 Group by dictionary value in for loop »
I'm trying to group by dictionary value inside for loop in an django template. My template is as follows : <div id="engines-rows"> {% for...
(3) odpowiedzi
2017-02-05 08:02 Why does copying a >= 16 GB Numpy array set all its elements to 0? »
On my Anaconda Python distribution, copying a Numpy array that is exactly 16 GB or larger (regardless of dtype) sets all elements of the copy to 0: &...
(1) odpowiedzi
2017-02-05 07:02 Django Rest Framework Get Forms as json »
Django Rest Framework is populating the HTML form.Like This Is any way possible can get the html form in json format as well along with default behav...
(1) odpowiedzi
2017-02-05 03:02 Mandelbrot set displays incorrectly »
This is my attempt to program the Mandelbrot set in Python 3.5 using the Pygame module. import math, pygame pygame.init() def mapMandelbrot(c,r,dim,...
(2) odpowiedzi
2017-02-05 00:02 turn rows values to columns , and count repetitions for all possible values mysql »
I have a table(from log file) with emails and three other columns that contains states of that user's interaction with a system, an email(user) may ha...
(4) odpowiedzi
2017-02-04 22:02 Why does pyplot.contour() require Z to be a 2D array? »
The matplotlib.pyplot.contour() function takes 3 input arrays X, Y and Z. The arrays X and Y specify the x- and y-coordinates of points, while Z speci...
(2) odpowiedzi
2017-02-04 14:02 More idomatic way to display images in a grid with numpy »
Is there a more idiomatic way to display a grid of images as in the below example? import numpy as np def gallery(array, ncols=3): nrows = np.ma...
(2) odpowiedzi
2017-02-04 13:02 Django related_name not found »
I have this model: class Person(models.Model): something ... employers = models.ManyToManyField('self', blank=True, related_name='employees')...
(1) odpowiedzi
2017-02-04 12:02 Difference in performance of two seemingly similar dict statements? »
"One semi-gotcha to avoid though is to make sure you do: key in some_dict rather than key in some_dict.keys(). Both are equivalent semantically, but p...
(1) odpowiedzi
2017-02-04 11:02 Session authentication with Django channels »
Trying to get authentication working with Django channels with a very simple websockets app that echoes back whatever the user sends over with a prefi...
(1) odpowiedzi