Questions tagged as 'python'

1
answer

Filter an exact word in a dataframe (Pandas)

Code: texto = ['El', 'enfermo', 'grave', 'habla', 'de', 'trasplantes', '.'] for palabra in texto: filtro = data[data['palabra'].str.match(palabra, case=False )] print(filtro) An extract of the answer I get from the dataframe is:...
asked by 16.10.2018 / 01:19
1
answer

Average cycle with pandas

Good I have the following df , the question is that I need to filter the speeds per hour and with these take an average, I am utlizando the following code: import pandas as pd import numpy as np df = pd.read_csv('df.csv') b = df[(d...
asked by 30.04.2018 / 22:50
1
answer

Invalid Syntax with pyTelegramBotAPI

trying to import the library "telebot" gives me syntax error. import telebot I installed pyTelegramBotAPI and TelegramBotAPI perfectly with pip install     
asked by 11.07.2018 / 19:08
1
answer

Compare two .txt files using if else in python

I want to compare two text files in Python. According to the result (equal / deferent), you must continue with a conditional. Searching on Google I found this code, but it does not return anything (TRUE / FALSE). import filecmp filecmp.cmp('tx...
asked by 26.04.2018 / 01:16
1
answer

Python freezes in a While Loop

Using a while loop, I throw a command in cmd (windows), which repeats every 60 seconds. At a certain moment, the script that I launched per cmd freezes and the loop is locked. How can the python script interrupt and automatically start the while...
asked by 26.04.2018 / 23:17
1
answer

Draw an odd vector from a matrix. Python

n = int(raw_input("Ingrese N\n")) cont = 0 matriz = [] for i in range(n): matriz.append([0]*n) for i in range(n): for j in range(n): matriz[i][j] = int(raw_input("Elemento %d, %d : " % (i,j))) if(ma...
asked by 27.04.2018 / 03:47
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 / 06:03
1
answer

The url in Django is superimposed

I have an app with a product loading form for books (Product, Date of publication, file) After loading it generates its own url ( link ) But when selecting to see all the images, I get the following error: verimagenes.html {% extend...
asked by 27.04.2018 / 05:54
2
answers

I have problems with pip on mac osx

I am trying to install a library for python 2.7 in mac osx with pip in the following way: python -m pip install pyttsx and the shell returned: /usr/bin/python: No module named pip Then I tried to prove that if it existed with pyt...
asked by 08.05.2018 / 05:27
1
answer

NOT NULL constraint failed: worker_worker.rol_id

I have the following error NOT NULL constraint failed: worker_worker.rol_id  when saving the data using a modelForm Model class Trabajador(models.Model): nombres = models.CharField(max_length=50) apellido_paterno = models.CharField(...
asked by 24.04.2018 / 04:00