Questions tagged as 'numpy'

0
answers

Create an array by iterating the rows of a table of pandas with conditions. Python

I'm creating a table with pandas where the first two columns are created with numpy arrays: age = np.random.randint(20,85,size=400) possible_genders = ['male','female'] gender = [np.random.choice(possible_genders) for i in range(400)] the...
asked by 09.12.2018 / 19:58
0
answers

Error: Input arrays should have the same number of samples as target arrays.Found 6400 input samples and 1600 target samples

I'm trying to do classification but I have this error import os,cv2 import numpy as np from sklearn.utils import shuffle from tensorflow.python.keras.preprocessing.image import ImageDataGenerator from sklearn.model_selection import train_test_...
asked by 26.10.2018 / 23:11
0
answers

help to multiply two matrices?

I'm doing a program where I need to multiply the following matrices:    [[- 13. 6. -4.] [12. -5. 3.] [-5. 2. -1.]] This matrix that is the inverse of another one that you take out in this way: matriz_lista = np.array(lista_tempL).reshap...
asked by 30.10.2018 / 23:09
0
answers

Multiply lists of lists and matrices of NumPy

I'm trying to multiply matrices with python. The objective of the program is to have three matrices as parameters: A, B and res (result matrix) that will be completed with the result of multiplying the matrices represented by the lists of lists....
asked by 26.10.2018 / 02:22
0
answers

Problem with numpy meshgrid

I am stuck in a problem with matplotlib and using numpy.meshgrid. I have a 3D mesh of points called "grid3" in format x, y, z, pot. The point mesh is organized in the following way: x = grid3[:,0] y = grid3[:,1] z = grid3[:,2] pot = grid3[:,3]...
asked by 28.10.2018 / 18:14
1
answer

Remove column from a matrix

Passing a csv to an array with pandas creates a column to the left of everything indicating the row number that it is. How could it be eliminated? def cargar(): print("Indica la ruta donde se encuentra el CSV\n") print("Si desea salir puls...
asked by 08.10.2018 / 23:25
1
answer

Approximation of numbers in a matrix

I have the following matrix: [[-397. -259. -51. -227. -116. -227.]  [351. 237. 58. 204. 117. 204.]  [-140. -98. -25. -83. -fifty. -83.]] and I'm trying to leave this matrix, all in module 29 as follows: lista1 = [] for x in matrizf:     ...
asked by 03.11.2018 / 04:31
0
answers

How to add a list to a variable that contains a list and the result use it as a list to extract data from a dataframe with "at"

In the variable MARCADOR , LAD and FAD I would like to extract with each cycle for data% DataFrame intersection : INCREMENTO = np.array([0, 0]) for x in range(self.total_rows): MARCADOR = self.intersectio...
asked by 05.09.2018 / 17:59
0
answers

QSpinBox range assignment

I have to define a QSPINBOX in pyqt, where the values taken by the QSPINBOX each time the ValueChanged () signal returns is that of a defined vector. For example: vector = [10, 15, 3, 20] In other words, the QSPINBOX in this case...
asked by 28.08.2018 / 16:18
0
answers

Cycle for averages with Pandas, frequency every 5 minutes

Hi, I have this df. I am trying to obtain average values assigned to each hour of measured data with a frequency of 5 minutes. This is how I charge the df from MySQL: import mysql.connector from mysql.connector import errorcode import pa...
asked by 13.06.2018 / 00:45