Questions tagged as 'python'

1
answer

Problem with authenticate (username = username, password = password) in django

I am trying to make a login for an api with django rest framework, I am guiding myself with this video: link Here is just the code I use in the login view: orders / urls: from django.urls import path, include from . import views from r...
asked by 21.06.2018 / 08:02
1
answer

Error exporting "logistic_regression" in naive Bayes classifier

In this code we try to make a naybe bayes classifier and show a graph with the results. import numpy as np import matplotlib.pyplot as plt from sklearn.naive_bayes import GaussianNB from logistic_regression import plot_classifier imput_file...
asked by 04.06.2018 / 21:41
1
answer

problem with selector with space, selenium python

I have a problem with the selectorer, which has a space at the beginning: I have something like this on html: <div class=" _xyz"></div> and in python I do this: driver.find_elements_by_class_name(' _xyz') or this...
asked by 16.06.2018 / 20:15
1
answer

Maximize and restore the window

I have the following code: from PyQt5.QtWidgets import QMainWindow,QApplication, QDesktopWidget from PyQt5.QtCore import * from PyQt5 import uic from PyQt5 import QtCore class Principal(QMainWindow): def __init__(self): QMainWind...
asked by 14.07.2018 / 06:17
1
answer

ModelMultipleChoisefield with unique objects from each user Django

I have a user model that has a ManytoMany () field to another object: class PrivateWallet(models.Model): name = ... class Usuario(AbstractUser): private_wallets = models.ManyToManyField(PrivateWallet, blank=True) and I want to crea...
asked by 14.07.2018 / 22:27
1
answer

Only detect a column when loading csv

I have my historical series downloaded in a csv file, which has 5 columns    ['Date', 'Price', 'Open', 'High', 'Low'] I do the following: import pandas as pd df = pd.read_csv("C:/Users/Lazardi/Desktop/GFG.BA.csv", header=0,index_col=Fal...
asked by 02.06.2018 / 19:11
1
answer

How can I modify a list that is composed of objects of a class

Hello friends I am trying to be able to modify the content of a specific variable, which is inside an object in a list, by means of the index I can obtain the position of the object in the list, but how can I do it to specifically modify the con...
asked by 04.06.2018 / 04:11
1
answer

Change text color of an Entry () disabled

I was discovering a bit more of tkinter and it gives that, doing a Entry , I wanted it to be deactivated but with the text of a certain color. I've tried it with the fg= attribute but it does not work. I tried to report on how to do i...
asked by 24.06.2018 / 17:58
2
answers

exception http.client in Python

I'm trying to handle exceptions I have the following code: conn = http.client.HTTPSConnection (site, timeout = 5) When the waiting time exceeds What exception should I use? try: conn = http.client.HTTPSConnection(site, timeout...
asked by 08.06.2018 / 23:36
1
answer

local variable referenced before assignment

I am having problems with this code, it appears that the variable specified in line 242. (Marked): totalCompra= totalCompra + int(aux2[2])*int(itemAmount) UnboundLocalError: local variable 'totalCompra' referenced before assignment I...
asked by 09.06.2018 / 02:31