Questions tagged as 'numpy'

2
answers

I want to modify a matrix but I can not

I want to modify the matrix created in arr per column (the one that the user wants) and per row (the one that the user wants) entering the value he wants: from numpy import * arr = zeros((2,2)) for j in arr: for k in j: k = 5 print...
asked by 26.05.2017 / 04:58
1
answer

Compare an element of one matrix with the next one and if it is equal to eliminate the complete row in python

I have this matrix    and I need to delete the rows that have the elements of the second column repeated I need something like this:    I have this code: for i in range(a,b): if lines3[i-1,1] == lines3[i,1]:...
asked by 20.05.2017 / 00:21
2
answers

Python - Convert float to string

I have a matrix of floats of 3000 by 17, the theme is that in the first column I want to save strings. With the following code: tabla = numpy.empty((3000, 17)) nombres = ['i0{i}_0{d}_{n}.bmp'.format(i = imagen, d = distorsion, n = nivel)...
asked by 10.04.2017 / 20:52
1
answer

Multiply matrices 3 * 2 and 2 * 2

Why can not I multiply these two matrices? c = np.array([[1,0], [2,1],[3,8]]) d = np.array([[3,5], [2,3]]) print c*d I do not understand what happens, if I do it with my calculator if I can because it is a 3x2 and a 2x2. I should leave...
asked by 04.11.2018 / 16:19
1
answer

how to propose the following sentence in python?

I have an algorithm in which it is stated as such and I have to execute certain commands in python as the algorithm raises so I can not modify, how can I raise the following sentence? where An is an angle, and everything with the root...
asked by 28.06.2018 / 02:13
1
answer

HOW DO I SOLVE IT? I get an error in line 110, in module Action_List (4) NameError: name 'Activity_List' is not defined?

# importando modulos necesarios import matplotlib.pyplot as plt import numpy as np import seaborn as sns import random as rm #Estados(Nodos)-->4 EVENTOS Estados=["Dormir","Entrenar","Correr","Jugar"] Lista_Actividad=[] #Posibles secuencia...
asked by 14.11.2018 / 01:12
1
answer

Show all combinations by multiplying all the numbers in a matrix

Particles of a matrix of three columns and an indefinite number of rows.The numbers of the first and second row can be any number, and the third column is always a column of 1. Let's say that the number of rows is 5, and we have for example the...
asked by 23.09.2018 / 18:37
1
answer

BINARY 32 BITS TO REAL CONVERTER

It turns out that I must convert the given binary with the following formulas, using point product for the summation. I designed this code import numpy as np #Creamos el arreglo bs que me separa individualmente los elementos del stri...
asked by 28.02.2018 / 01:36
1
answer

Error trying to calculate element with the highest value of an array

I have a problem with the following function: def conjunmas(): for (conjunto) in (arreglo): totalm = 0 cma = 0 for (unidad) in (arreglo): totalm = (totalm + unidad) if (totalm > cm...
asked by 10.05.2016 / 02:49
1
answer

How to work with datetime

My problem is that I do not know how I can do to work with datetime but faster, when I do for it takes almost 1 day to run df2 = pd.DataFrame({'fecha1': ["2018-3-3","2018-4-15"], 'fecha2':["2018-02-31","2018-...
asked by 04.01.2019 / 02:12