Questions tagged as 'python-3.x'

1
answer

how to get the largest item in each row with numpy?

I try to get a list of the indexes of the largest elements in each row a = np.arange(16).reshape((4, 4)) print(a) print(np.amax(a, axis=1)) print(np.where(a == np.amax(a, axis=1))) this is the result: I get the largest matrix wher...
asked by 20.11.2017 / 05:33
1
answer

How can I compare the output of a type () function with a string?

If I have a python script like this: texto = "TEXTO" cadena = "<type 'str'>" salida = type(texto) if(cadena == salida): print("Es un string") else: print("No es un string") I think in theory it's fine because you're comparing...
asked by 11.11.2017 / 16:46
1
answer

Type Error with raise statement

I'm trying to write a very simple function that I saw in the book "Learn to think like a programmer with python": def elige_numero(): x = input("Escriba un número: ") if x == str(17): raise('ErrorNumeroMalo', 'El 17 es malevolo...
asked by 16.09.2017 / 17:38
3
answers

Do operations on columns in a Dataframe loop

I want to do calculations on three columns of an array values_array . def calculateAllEMA(self,values_array): df = pd.DataFrame(values_array, columns=['BTC', 'ETH', 'DASH']) for i,column in enumerate(df[column]): ema=[]...
asked by 11.08.2017 / 18:01
2
answers

Problem in assigning arrays in Python

Hello, I do not know if this question has already been answered, but my problem is this: When assigning a global variable to a local variable of a class, changing the value of the local variable also modifies the value of the global v...
asked by 06.08.2017 / 18:31
1
answer

Problems with the pip install

I wanted to install the ttk libraries but it does not let me, the same to install Tkinter, try pip and did not find anything, I also tried to download them with Pycharm but it does not leave me anyway. I'm trying with Python 2.7 and 3.6     
asked by 06.03.2017 / 03:01
1
answer

Django CORS 'Access-Control-Allow-Origin'

I'm trying to redirect a Django View function to a page in PHP, currently hosted on my own computer. The fact is that I've seen that it gives me a crossover error because I'm calling another link from my own team. I have found a module cal...
asked by 29.01.2018 / 10:05
1
answer

Set range of values for random.randrange ()

I have a problem in Pygame when trying to get random values within a range with random.randrange , this is my code: import random import pygame WIDTH = 800 HEIGHT = 600 RED = (255, 0, 0) GREEN = (0, 255, 0) BLUE = (0, 0, 255) WH...
asked by 25.01.2017 / 00:43
1
answer

How can you download a file with Python with multiple connections (for example: something like the IDM download manager)?

What I'm looking for is to accelerate the download of files this is what I have so far: ruta = os.getcwd() r = requests.get('https://video.xx.fbcdn.net/v/t42.90402/10000000_200409650451005_3436979597881638912_n.mp4?efg=eyJ2ZW5jb2RlX3Rh...
asked by 02.04.2017 / 13:18
1
answer

Legends in bokeh with latex

I would like to know if there is any way to write the legends in Bokeh with LateX format. I say this because it is quite frustrating to write f(x)=x^3-1 , it is very poor.     
asked by 08.05.2016 / 22:38