Questions tagged as 'python-2.7'

1
answer

Error with pd.DataFrame.replace, can not convert unicode string to float

I am trying to multiply a data frame by reference so I am using a dictionary to multiply it. When I try to fill my dictionary with the values in Excel rows I can not convert the values to float since they are unicode. I am using Python 2.7.10, c...
asked by 30.06.2018 / 22:50
2
answers

Repair infinite while loop

I have this program to solve within the resolution I have a loop while infinite and I do not know how to put it, because if I use a break I leave the funcion and I can not continue entering data to my program. It has to b...
asked by 18.05.2018 / 05:35
1
answer

Data entered using form made in tkinter are not inserted in the database

I have a Python code with Tkinter where the user must enter their email, password and a destination email. Later this data must be recorded in a database sqlite, but I can not record the data ever. My code is as follows: #!/usr/bin/python #...
asked by 28.04.2018 / 04:03
1
answer

How to add a matrix and headings to a DataFrame that already has an index

I have an array of results and I would like to put it in a DataFrame who already has an index with the following headings "one, two, three, four, five, six, seven" to be able to export it in csv format: [[ 9.98611569e-01 2.61135280e-01 9....
asked by 10.02.2018 / 15:09
2
answers

Given the hash () of Python, does it exist similar in PHP?

I have a python script, which performs a login and pass, which is stored with hash in Mysql, with the following code: pass = hash(self.get_argument("psw", 'dato')) generating a hash type -5995266028892256335 Now I need to login from PH...
asked by 26.01.2018 / 12:54
2
answers

Hello I want to delete certain content from a folder

I have a simple doubt. I have generated some files in different formats (.csv, .txt, etc) I need to delete some. Specifically all ".csv" and those that end with "h + *. Txt" (with * any integer from 1 to 99). I've tried this: for arc...
asked by 26.01.2018 / 12:54
1
answer

Delete rungs from a Python csv

With the following code I convert an XLSX into CSV. I need to delete the first 10 lines of the resulting csv. How could I do it? # encoding=utf8 import sys import xlrd import csv reload(sys) sys.setdefaultencoding('utf8') def csv_from_excel...
asked by 20.12.2017 / 17:17
1
answer

List of CSV lists in Python

Through the CSV that I leave at the end of the code I get the information that will be modified with my code. The problem is that when I have the information I want and I want to save it in a new CSV I can not because I only copy the first row o...
asked by 07.12.2017 / 14:07
1
answer

Error "IOError: [Errno 22] invalid mode ('w') or filename" when creating csv file

I need to convert this Python code that I use in MAC to some that I can use in Windows 10 with the same version of Python (2.7). Basically I open a csv and I load it in a DataFrame, I group by one of the columns and create a new csv for each...
asked by 07.12.2017 / 23:07
1
answer

Renew Tor's IP in Python

I have the following code: import requests import time from stem import Signal from stem.control import Controller def get_tor_session(): session = requests.session() session.proxies = {'http': 'socks5://localhost:9050','https': 'soc...
asked by 29.10.2017 / 18:18