Questions tagged as 'python-3.x'

1
answer

Django queryset, calculate subtraction of two numbers

I have the following model: class MyClass(models.model): usuario = models.Charfield(max_length=45) saldo_ini=models.DecimalField(decimal_places=1,max_digits=10, null=True) saldo_fin=models.DecimalField(decimal_places=1,max_digits=1...
asked by 25.07.2017 / 00:10
1
answer

Problem with global variable

I am preparing an exam and I have been doing several exercises, the problem arises when I get to the part of object-oriented programming (OOP) in this exercise:    Write a class that allows you to represent the character of a video game.   A...
asked by 18.02.2018 / 21:06
1
answer

TypeError: Image data can not be converted to float

I have a problem with the following code: import cv2 import matplotlib.pyplot as plt img1 = cv2.imread('images\colombia_city.jpg') img2 = cv2.imread('images\colombia_city_2.jpg') #img = img1 + img2 #img = cv2.add(img1,img2) abc = cv2.addWei...
asked by 18.02.2018 / 02:50
1
answer

How to use python3 by default in mac?

I'm starting to use python on mac and I have a problem that I can not solve. I have installed the latest version of python 3.6.4 in macOS High Sierra. In sublime text I have installed the sublimeREPL package, with which I use the option: "...
asked by 17.03.2018 / 21:15
1
answer

Show only repeated elements with Pandas

Suppose I have a list in .csv with different columns, one of them is "teacher name", the second "subject" and the third is "year". There may be something similar to this: Nombre profesor Asignatura Año Juan Mates 2002...
asked by 15.11.2018 / 23:56
3
answers

Working with parameters of a table using Pandas

I have a .csv file that contains this type of data: Nombre Curso Nota Miguel Primero 8 Juan Primer 2 Pedro Segundo 6 Luisa Primero 6 Teresa Primero 3 Pepe Segundo 5 Ana Segundo 6 Natalia Se...
asked by 14.11.2018 / 14:58
2
answers

Error in conditional with estamento in: "requires string as left operand, not set"

I am creating a loop that will iterate over a list of given strings. For this I have created a set of data on which I will establish my conditions within the loop. But I think I'm doing something wrong because in the Python shell I get the fo...
asked by 03.10.2017 / 22:29
1
answer

Error in import: module 'random' has no attribute 'randint'

I was testing the corrected code for this question: Modify global variables . And when I try to execute it in the terminal it throws me an error that says that the% random module does not have the randint attribute (which does not...
asked by 22.09.2017 / 00:33
1
answer

Python 3: AttributeError

Hello, I am trying to make a very simple program that creates the data of a rectangle and finds its center: class Rectangulo: pass def encuentra_centro(box): p = Rectangulo() p.x = box.esquina.x + box.anchura / 2.0 p.y = box.es...
asked by 17.09.2017 / 01:43
1
answer

Error modifying elements in sublists, all end with the same content

Someone could tell me why I have an error in the following code: tabla=[] linea=['0'] for k in range (3): linea.append('') for k in range(12): tabla.append(linea) i=0 for k in ['1','2','3','4','5','6','E','F','P','G','2G','T']: tab...
asked by 27.09.2017 / 17:26