Questions tagged as 'numpy'

5
answers

Matrix NxM (2D) in Python with Numpy

I'm trying to solve a college activity but I could not transpose the logic into the code. The case is as follows: "The user will enter the integers in the same row separated by space. After the user passes the values, the following values will b...
asked by 16.08.2018 / 01:52
2
answers

Adding points in a range of known data

I'm working on data analysis using Python and for this I'm training algorithms like SVC and K-means. The data used for the training have a fixed spacing between each sample, since they are sampled by an oscilloscope in fixed periods of time, in...
asked by 19.02.2018 / 20:05
1
answer

Pandas iterrows, how to do the second looping using the index

for index, row in candles.iterrows(): if (row['Twintower'] == 1): I would like to do a second looping from the moment he finds this condition, ie from this index down, or row down, I tried several options TypeError...
asked by 22.12.2018 / 22:55
2
answers

Error in indexing when separating line information

import pandas as pd import numpy as np import matplotlib as plt df = pd.read_csv('dito_julho.csv') df.head() campanha valor 1 Prospect | 5 dias | Com crédito 2 2 Prospect | 5...
asked by 10.08.2018 / 21:55
1
answer

Assign day time to hours

I have the following df: df = pd.DataFrame({'hora completa':['21:35:00', '22:16:00', '00:50:00', '09:30:00', '14:30:00']}) print(df) hora completa 0 21:35:00 1 22:16:00 2 00:50:00 3 09:30:00 4 14:30:00 I need to...
asked by 14.06.2018 / 05:59
1
answer

How to make a frequency distribution table in Python? [closed]

Good afternoon, One question: Could anyone clarify me how I can make a frequency distribution table: classes; absolute and relative frequency; cumulatively; average values of each class.     
asked by 19.01.2018 / 20:31
1
answer

Straight brackets (brackets) wrong?

I have this function in Matlab cn = reshape(repmat(sn, n_rep, 1), 1,[]); In Python I have the following code: import numpy as np from numpy.random import randint M=2 N=2*10**8 ### valor de Dados n_rep = 3 ## numero de repetições sn = ran...
asked by 07.10.2017 / 00:27
1
answer

How to mount an array in python with undefined value of i and j

I'm a beginner in python and I'm doubtful about array assembly. In the case, I did the following: import numpy as np n=3 A = np.zeros((n*n,n*n)) j= 2 i = 2 k = i+n*(j-1) a = -4 L1 = i-1+n*(j-1) a1 = 1 L2 = i+1+n*(j-1) a2 = 1 L3 = k-n a3 = 1 L4...
asked by 08.11.2017 / 03:50
1
answer

Identifying the most efficient method of identifying the central element of an array

I have the following algorithm: import numpy as np matriz = np.array(np.zeros(81).reshape(9, 9)) for i in range(1, matriz.shape[0], 3): for j in range(1, matriz.shape[1], 3): matriz[i, j] = 255 print(matriz) It generates the...
asked by 23.09.2017 / 16:52
1
answer

Warning pandas, 2 loopings!

I have a problem with this looping, because it is a situation that I can not solve with np.where , why have to run DataFrame to find the value of the gain or loss from another condition, whichever comes first . It's working but I...
asked by 22.12.2018 / 02:16