Questions tagged as 'python'

1
answer

Problems importing libraries in Python

I'm doing a tutorial on beautifulsoup in Python (version 2.7) with the following code: from bs4 import BeautifulSoup import urllib2 f = open ('C:\Python27\project\FFootball_DiamondMine\outfileESPN.txt','w') errorFile = open ('C:\Python27\proj...
asked by 16.03.2017 / 02:20
1
answer

Python. Store values in a dictionary

Imagine that in an experiment a participant draws a signal: Senal1_part1 = random.choice("ABCD") Senal1_part2 = random.choice("ABCD") I create a dictionary where I want to store the signals that that participant will observe throughout the...
asked by 13.12.2016 / 01:45
1
answer

Problem with tuple

Good, we have done this method of genetic algorithms in Python 3 but we have a problem of assignment to the tuple. We have read that a solution could be to convert the tuple to list but we do not know how to do it. def selection_and_reproducti...
asked by 14.07.2017 / 17:22
1
answer

Save the ip when sending a form django

I want to add a field in the Post class that stores the ip of the person who sends the form. This is my "models.py" file from django.db import models from django.utils import timezone class Post(models.Model): author = models.ForeignKey('...
asked by 23.07.2017 / 19:16
1
answer

Pandas Load bad dates in Python 3

I'm scheduling a task in Python but loading the dates of a CSV using Pandas loads them erratically, sometimes changing the day for the month. For example, for these cases everyone should be from month 06, but sometimes it is 06 and sometimes it...
asked by 24.07.2017 / 21:03
1
answer

I have problems to make a query when comparing dates in different formats

Good afternoon, I would like to know if you could help me with this problem. I have this model where I record the sales made by each user on a default date and that is in datetime now = datetime.datetime.now() db.define_table('registros...
asked by 08.09.2016 / 21:30
2
answers

MySQL Connector / Python does not perform the Commit

I have the following function that must take the data from a JSON and save it in a MySQL database def saveMetric(metrics): cnx = RDS_Connect() cursor = cnx.cursor() jsonMetrics = json.loads(metrics) #print type(jsonMetrics...
asked by 14.04.2016 / 02:34
2
answers

Can you graph in real time in python?

I've been trying to get a graph in real time with matplotlib but it's almost impossible, is there any way I can do this? The issue is that I am receiving data through the usb port and I am storing them in a list, which is increasing as there...
asked by 22.04.2016 / 21:55
1
answer

Difference between numpy.empty and numpy.array

np.empty is considered a junk vector in which it serves to know what type of data contains the vector and a np.array returns an array, but in which case it is more convenient to use each of them.     
asked by 12.12.2017 / 22:23
1
answer

Structure for project in Django [closed]

What is the recommended structure to create a project? /proyecto /app01 /app02 manage.py I have 3 doubts: Is an application (app) considered a module in the project? What is a module in Django? What is an application on Django?
asked by 17.02.2016 / 04:52