Questions tagged as 'python'

1
answer

Python - KeyError

Someone can help me! I am reading from a csv file and then I do an INSERT on the MySQL database, but I get the following error KeyError: 'id' I have checked the CSV file several times, the file has all the columns and exactly the same...
asked by 01.10.2018 / 23:53
1
answer

TypeError: object of type 'NoneType' has no len ()

I'm trying to apply the NMF algorithm in a csv and then extract the phrases attached to each topic import pandas from sklearn.feature_extraction.text import TfidfVectorizer from sklearn.decomposition import NMF def display_topics(model, featu...
asked by 14.09.2018 / 16:00
2
answers

Random search does not work

I want to do a random search in the database, but it is not working. I want to take a sentence, and show it on the screen, it will be changed every time I refresh the screen. My view.py: def busca_tendencia(request): tendencias = Frase....
asked by 25.10.2018 / 14:50
1
answer

How can I save the private key and publish it for use later? and the program always generates different keys?

Well, I would like to be able to save the private key and publish it to use later to encrypt and if someone wants to decrypt my message, but every time the program generates a new key. How can I save the keys and then use it later to encrypt or...
asked by 25.10.2018 / 07:41
1
answer

Script to recognize similarity between images

Good Afternoon Personal, okay? I'm starting my studies in Python set to OpenCV, and I want to perform the reading of images and display the degree of similarity between them. Ex: I have a database with several images, I will give the scrip...
asked by 12.09.2018 / 17:49
1
answer

OpenCV error in Python:

Good Afternoon Personal, okay? I'm looking to learn about Face Detection in Python using OpenCV, I installed all the necessary libs, however, when running the file I come across the following error: import cv2 import numpy as np face_casca...
asked by 10.09.2018 / 20:43
1
answer

How to replace a certain string sentence in Python? Using re.sub ()

I would like to replace every expression that starts with the characters: *: . tentativa = 'Olá td bem? *:palavra_proibida*985 td otimo' resultado = re.sub('*:', '', tentativa) Result Obtained: Olá td bem? palavra_proibida*985 td ot...
asked by 03.09.2018 / 23:18
1
answer

Return HD size and free space for client-server

I would like to return to the client HD size information beyond the available space. Client Code import socket, pickle HOST = 'localhost' PORT = 9991 udp = socket.socket(socket.AF_INET, socket.SOCK_DGRAM) dest = (HOST, PORT) msg = input('En...
asked by 04.09.2018 / 09:23
1
answer

Calculating a date within the Model Django timedelta

I'm declaring a function (data_prox_prog) to calculate a future date and store in the model, but it's not happening as expected. Here is the code: class ProgressaoDocente(models.Model): servidor = models.ForeignKey(Servidor, on_delete=models.P...
asked by 02.09.2018 / 04:56
1
answer

Django forms.CheckboxSelectMultiple issues: Select a valid choice. [''] is not one of the choices available

I'm trying to use a checkbox to select items in a list, but it returns the following error: Select a valid choice. [''] is not one of the available choices. app models.py : from django.db import models from django import forms from djan...
asked by 31.08.2018 / 19:49