Data dodania Pytanie
2017-10-07 18:10 Flask socket.io message events in different files »
socketservice.py: from flask import Flask, render_template from flask_socketio import SocketIO, emit from backend.database import db app = Flask(__n...
(1) odpowiedzi
2017-10-07 14:10 Fast complex SQL queries on PostgreSQL database with Python »
I have a large dataset with +50M records in a PostgreSQL database that require massive calculations, inner join. Python is the tool of choice with Ps...
(3) odpowiedzi
2017-10-07 11:10 Django & Socket Server: Can I add socket server instance to "memory"? »
I'm working with: Django 1.11 Python Sockets I have a Socket server like this: class SocketServer(threading.Thread): def __init__(self, ip="...
(0) odpowiedzi
2017-10-07 05:10 In NumPy, how to explain the return of ndarray[True]? »
In NumPy, I know that we can index an ndarray by boolean values in the following way in a Python interpreter: >>> import numpy as np >&gt...
(0) odpowiedzi
2017-10-07 04:10 Python SyntaxError: invalid syntax, are brackets allowed in function parameters in python3? »
The function works in python2: def setCellValue(self, (x, y), value): self.map[x][y] = value But when I'm trying in python3 it shows invalid sy...
(2) odpowiedzi
2017-10-07 02:10 python - why does multiplication of long and float produce decimal-like answer? »
In this example: long_ten = 10**21 print(' type(long_ten):', type(long_ten)) print(' long_ten: {:52,f}'.format(long_ten)) tenth = 0.1 print(' t...
(2) odpowiedzi
2017-10-07 00:10 How to import a csv-file into a data array? »
I have a line of code in a script that imports data from a text file with lots of spaces between values into an array for use later. textfile = open(...
(2) odpowiedzi
2017-10-06 22:10 Find longest unique substring in string python »
I am trying that age old question (there are multitudes of versions around) of finding the longest substring of a string which doesn't contain repeate...
(2) odpowiedzi
2017-10-06 21:10 Django enforcing unique constraint on set of members in ManyToManyField »
I am working in Django and I'm having some trouble enforcing a particular constraint on my data models. I have a model that consists of a group of mem...
(1) odpowiedzi
2017-10-06 20:10 creating dictionary from the list with each elements as key:value pairs in python »
I have a list where the content of list are key:value pairs something like shown below sample =['ldb:21', 'baseB:4', 'cache-6:55', 'Xauthority:1', '...
(4) odpowiedzi
2017-10-06 15:10 ~./zshrc : command not found: $ »
I'm currently going through Django tutorials on ProjectDjango.com. However I'm stuck on the very first bit! I'm told to enter the following into the...
(3) odpowiedzi
2017-10-06 10:10 Is it a good practice to upgrade all python packages in production to their latest versions? »
I am running a fairly complex Django application, for about a year now. It has about 50 packages in requirements.txt Whenever I need a new package, I...
(3) odpowiedzi
2017-10-05 23:10 How to disable chrome's "save password" popup in selenium webdriver (python) »
I want to disable the "save password" popup in chrome in my selenium test whenever it appears. I found a way through ChromeOptions(), but can't find t...
(2) odpowiedzi
2017-10-05 18:10 pandas groupby and boolean selection »
I often end up doing things like this in pandas: s2 = s1.groupby(level=1).sum() s2 = s2[s2>25] In words, I do some groupby operation and then wa...
(2) odpowiedzi
2017-10-05 17:10 python recursive variables referenced or copied? »
I have the following recursive function, and I'm having trouble figuring out how python handles variables in recursive functions. Will it create a co...
(1) odpowiedzi
2017-10-05 12:10 How to do not select duplicated values from db? »
I have the following comment table(comment and corresponding info including photo_id) comment_id | photo_id | ... com_1 | pho_1 | ... co...
(1) odpowiedzi
2017-10-05 09:10 Writing python2 codes in python3 »
Can I write python 2 syntaxes in python 3 file and compile with python 3 compiler? What I mean is this: I know that by using future__import one can u...
(1) odpowiedzi
2017-10-05 00:10 django delete object with html button »
I have a simple site project in Django and I have movies lists in man page and movies details in the second page. I want to add a delete button on mo...
(1) odpowiedzi
2017-10-05 00:10 My python code is taking 8+ hours to iterate over big data »
Update: It's been over 24 hours and the code is still not done yet :) I have this python code below. Basically, this code is currently only using 1% ...
(1) odpowiedzi
2017-10-04 15:10 Python element access performance »
being a long time C++ developer I just started working on algorithms in Python. I'm currently profiling my code to get a feel for how to program effic...
(1) odpowiedzi
2017-10-04 12:10 Python Pandas Data frame creation »
I tried to create a data frame df using the below code : import numpy as np import pandas as pd index = [0,1,2,3,4,5] s = pd.Series([1,2,3,4,5,6],ind...
(2) odpowiedzi
2017-10-04 11:10 Create an estimator tool in Django Python »
I am new to Django. I have read the official documentations and managed to create models in Django. I have a task to create an estimator tool that cou...
(1) odpowiedzi
2017-10-04 11:10 DRF3 Creating nested serializers on m2m-relation »
I have a User-model and a Concert-model. The Concert-model has a m2m-field to the User-model. In the Concert-views, I want a list of dictionaries of t...
(1) odpowiedzi
2017-10-04 08:10 How to conditionally combine two numpy arrays of the same shape »
This sounds simple, and I think I'm overcomplicating this in my mind. I want to make an array whose elements are generated from two source arrays of ...
(2) odpowiedzi
2017-10-04 04:10 Python: How to generate all combinations of lists of tuples without repeating contents of the tuple »
I'm working with a bit of a riddle: Given a dictionary with tuples for keys: dictionary = {(p,q):n}, I need to generate a list of new dictionaries of...
(2) odpowiedzi
2017-10-04 03:10 Django 1.8 csrf NameError: Undefined »
I am using Django_Mako_Plus on top of Django. And as I try to put a ${csrf_input} after my form. I am getting a NameError: Undefined. The middleware i...
(0) odpowiedzi
2017-10-03 17:10 How to create txt frequency counter with all letters (a-z) in python 3 »
I have a text file named textf that looks something like the following: rxgmgcwbd c qcyurr bkxgmq, lwrg grru rrwxtam rwgzwt am quyam cv avrrgdwkxgcr....
(6) odpowiedzi
2017-10-03 16:10 Why does conda create try to install weird packages? »
I am trying to install a new conda environment that will be totally separate from my other environments, so I run: conda create --name foot35 python=...
(0) odpowiedzi
2017-10-03 12:10 Django issue : UnicodeEncodeError »
I'm getting this common error in my code : Exception Type: UnicodeEncodeError Exception Value:'ascii' codec can't encode character u'\xe9' in positio...
(2) odpowiedzi
2017-10-03 12:10 Django How to add a logout successful message using the django.contrib.auth? »
I am not using all-auth I am using the standard authentication system and url's provided by django.contrib.auth. I have also ensured that when loggi...
(1) odpowiedzi
2017-10-03 10:10 Python - "xor"ing each byte in "bytes" in the most efficient way »
I have a "bytes" object and an "int" mask, I want to do a xor over all the bytes with my mask. I do this action repeatedly over big "bytes" objects (~...
(2) odpowiedzi
2017-10-03 06:10 Issue with python version 2.7.3 importing maxrepeat module »
I am trying to import maxrepeat module in python 2.7.3 and couldn’t get much information in google can some one please help. What is the module tha...
(1) odpowiedzi
2017-10-03 04:10 In Ruby, why does `Array.length` give NoMethodError? »
In Python, I can get the length of a list by calling its __len__ method. __len__ is not defined on each individual list object, but on the list class....
(1) odpowiedzi
2017-10-02 15:10 Pickle a dict subclass without __reduce__ method does not load member attributes »
I have the need to ensure that a dict can only accept a certain type of objects as values. It also have to be pickable. Here is my first attempt: ...
(1) odpowiedzi
2017-10-02 14:10 What is the most efficient way to tune the settings of a sensor, such that it gives optimal readings? »
I have a fairly simple sensor which outputs a measured distance, with a number of adjustable parameters which determine how the sensor takes said meas...
(0) odpowiedzi