Questions tagged as 'python'

1
answer

Time out with unexpected result

I'm running a code that sets the hours in the terminal but when I use the code below it brings me a totally wrong value at the time: Code: from time import gmtime, strftime print(strftime("%a, %d %b %Y %H:%M:%S +0000", gmtime())) Here is...
asked by 20.09.2018 / 22:42
1
answer

File comparison program in python

I have a question and a great difficulty creating a program that reads 2 files, example doc1.txt and doc2.txt , inside the files it has the following data: doc1.txt doc2.txt 1 1 1 2 2 5 3...
asked by 04.07.2018 / 03:26
2
answers

Find values in a list that are the same as the index where they are. How to optimize?

I'm learning programming with Python 3.6 and I'm taking part in a challenge site. I need to find the smallest number whose value corresponds to its index in a list. If the list contains only one element, it should return the same. If there is...
asked by 19.08.2018 / 15:49
1
answer

How to translate an image in python?

My intention is to do as in the figure below: link My role: def translacao(imagem1): imagem1.save("translate.png") destino = Image.open("translate.png") destino = destino.resize((400,400)) #Tamanho Imagem - Largura e Al...
asked by 08.10.2014 / 04:03
1
answer

Fourier transform problem

I'm having a problem using numpy's fft function. When rotating it, the answer is giving different from the Fourier transform that I implemented manually and by the tests I did the manual seems correct. I think I'm using fft the wrong way. impo...
asked by 23.06.2018 / 04:33
1
answer

Lambda function for dict dict - Python

I would like to know if there is a possibility of using filter with a lambda function to select a conjunto de dados of a array de J SON in Python . Example: I have the following JSON already as dict...
asked by 07.10.2018 / 04:58
1
answer

How to make this class usable?

In the code below, I would like to return an instance of the class itself with the data filled in through a text file. The lines are stored this way in the file:    Yug Sekwaf, 13-04-1570,2-34,3: 21,2,34,2.45,3.01,2: 01,2: 01,3: 10,2-22 T...
asked by 13.11.2018 / 01:54
1
answer

Adding items inside an array

I have the following array: soma_campos = null tabela = [ ['A-B', 22, 0.045, 0.1, 0.005], ['A-C', 50, 0.020, 0.1, 0.002], ['A-D', 48, 0.021, 0.1, 0.002], ['A-E', 29, 0.034, 0.1, 0.003]...
asked by 10.11.2018 / 23:53
2
answers

Linear Regression in Various Products

I ran a simple regression to a database with a product (Product, Volume, Price). It turned perfectly. But I would like to run the same regression on a base with more products, however, I want to be able to choose the product I want to run the re...
asked by 31.01.2018 / 13:08
1
answer

What is a migrate? [duplicate]

I'm a beginner in the django world and one of the first things I find in tutorials is the term migrate I'd like to know what that means, how to use it and what it's for.     
asked by 02.02.2018 / 00:31