Questions tagged as 'python'

2
answers

Collect x samples of x simulations

The following code generates a CSV in which a series of columns are displayed (PLAYER, SIGNAL, ROUND1, ROUND2, ROUND3). In the columns "RONDAx" appear the times that each player has shown a determined signal in each round throughout 1000 simulat...
asked by 12.01.2017 / 15:21
1
answer

Copy a worksheet from one excel file to another

Hello, good morning, I have the following code. from openpyxl import load_workbook from openpyxl import Workbook wP =load_workbook(r'C:\Users\Arrontec\Desktop\Automatizacion\Request1_2.xlsx') wB =load_workbook(r'C:\Users\Arrontec\Desktop\Auto...
asked by 27.02.2017 / 16:42
1
answer

How to add a value from one table to another table with django

The point is to make an accounting entry. I'm using the admin of django and when I create a seat I must use two accounts (which already exist in the table account) and those add or subtract the value that entered the seat (total), the thing is t...
asked by 27.02.2017 / 06:21
1
answer

ValueError: x and and must have same first dimension

Greetings: I'm pretty new using Python and I was practicing with the following problem: I wanted to graph the value of heat transfer through an aluminum plate (I tried to make it as simple as possible by simply practicing how to graph resu...
asked by 11.01.2017 / 01:20
1
answer

Assign values depending on the initial lists

In the following code we have: pairings: variable that tries to represent pairs of players. In the example, player 1 plays with player 2 and player 3 plays with player 4. V1, V2, V3, V4: are variants or symbols that players show their oppo...
asked by 01.01.2017 / 20:14
1
answer

Python tweepy trends and tweets

I have the following code to get trends and show me the tweets that have been made from Madrid trends1 = api.trends_place(1) trends = set([trend['name'] for trend in trends1[0]['trends']]) print trends but when executing it, it brings out a...
asked by 11.12.2016 / 16:29
1
answer

Python 2.7 Alkane Nomenclature

I need to program the following situation in Python 2.7 ... ENTRY : Text file (.txt) with the formula of an alkane. OUTPUT : Carbon number where a structure is coupled to the longest chain next to said structure separated by "-". Exampl...
asked by 26.11.2016 / 16:48
1
answer

Python modbus as server

Does anyone know how to modify this Python file to be a server instead of a client? from pymodbus.client.sync import ModbusTcpClient client = ModbusTcpClient('127.0.0.1') client.write_coil(1, True) result = client.read_coils(1,1) print result...
asked by 28.11.2016 / 10:05
1
answer

Python - Django - Sum too slow from a list

I have a Django project related to energy consumption, through which I visualize the consumption of a household during a month. To obtain that information, I use the following code: consumos = Measurement.objects.filter(idhogar=hogar) filtrado...
asked by 02.03.2017 / 12:02
1
answer

Python / Django warn that your session is going to expire

I have a cookie that has been defined: SESSION_COOKIE_AGE = 3600 And I would like to warn the user when it will expire. What is the best way?     
asked by 15.11.2016 / 10:07