Questions tagged as 'python'

1
answer

How do I create a dictionary with multiple values eg? a list or tuple, for each key?

I have 2 lists lista_nom = [['Luisa Cordoba'], ['Olga Leiva'], ['Graciela Sanchez']] lista_mate = [['CIENCIAS', 7.2, 'MATEMATICAS', 9.0, 'ALGEBRA', 6.5, 'FISICA', 2.1, 'QUIMICA', 1.7], ['CIENCIAS', 4.5, 'MATEMATICAS', 9.8, 'ALGEBRA', 5.7, 'FI...
asked by 03.05.2018 / 02:19
0
answers

Error sending form in Mechanize

I am trying to autocomplete a form but I submit an error. I show my code explained by parts: import mechanize import cookielib import ssl ssl._create_default_https_context = ssl._create_unverified_context br = mechanize.Browser() cj = coo...
asked by 24.01.2018 / 02:04
1
answer

DataFrame.set_index has no effect

set_index does not work on Pandas DataFrame as indicated in the documentation. I'm using: Pandas version 0.20.3 Python version 3.6 I tried the example in the documentation: link import numpy as np import pandas as pd...
asked by 14.11.2017 / 23:25
2
answers

Sum of dictionaries

I'm working with python and django and I have several data dictionaries that I want to add up for a total. All dictionaries can have two keys primera and segunda , but I must get a total of both primera and segunda...
asked by 05.01.2018 / 01:06
1
answer

Input for a snake in Python

What I want is to create a snake and I would like to be able to detect which keys the user clicks on. I have a version made in C ++ in which the keystrokes are detected by a loop that is in another thread as I show here: vec2 dir(0,0); int ma...
asked by 20.12.2017 / 20:14
2
answers

Delete tildes in Python 3.6

enter the code here I am trying to delete the accents of a string I get when decrypting, looking in Google I found that to remove accents the unicodedata.normalize('NFD', string) method is used but when using it does not delete the accent...
asked by 26.03.2018 / 20:23
1
answer

Linear Regression and calculation of R2 for qualitative variable vs quantitative

I want to perform a linear regression in a data set of a landslide inventory. Each event has an area in square meters (the quantitative variable of my interest) and type of movement. The solution I have is to generate as many independent vari...
asked by 17.01.2018 / 01:19
1
answer

FileExistsError: [WinError 183] Unable to create a file that already exists

once the directory is created, when executing the code it gives the following error: How can I do so if that directory already exists, the function continues writing the file FileExistsError Traceback (most recent call last)  in ()       1...
asked by 04.11.2017 / 19:07
0
answers

Problem when pivoting a dataframe from two concatenated dataframes

Use Python 3.5 and Pandas 0.20.3 I get an error when I try to pivot a panda dataframe which I obtained using the concat function. I detail the process. This is my first dataframe. df = pd.DataFrame([ ['2017-01-03 21:00:00','2017-01-03...
asked by 05.11.2017 / 10:51
3
answers

Arguments sys.argv [1] .split () as string?

I'm stuck in a script. I try to expose you to see if you can help me. I define the following before entering the loop. cliente, fecha, hora, state, nombre, result, most_repeated = sys.argv[1].split() timestamp = str(fecha)+' '+' '+str(hora...
asked by 09.01.2018 / 10:16