python (12.9k questions)
javascript (9.2k questions)
reactjs (4.7k questions)
java (4.2k questions)
java (4.2k questions)
c# (3.5k questions)
c# (3.5k questions)
html (3.3k questions)
Replacing chunks of numpy array on condition
Let's say I have the following numpy array, of 1's and 0's exclusively:
import numpy as np
example = np.array([0,1,1,0,1,0,0,1,1], dtype=np.uint8)
I want to group all elements into chunks of 3, and ...
MeViMo
Votes: 0
Answers: 3
Changing the value of alternated rows of a vector in Python
Suppose I have the following NumPy array in python:
V = 2*np.ones([7,1]); V[0]=1; V[6]=1
Which will give me:
V = ([[1.],
[2.],
[2.],
[2.],
[2.],
[2.],
[1.],])
How...
Mateus Forcelini
Votes: 0
Answers: 2
Errors with indexing when using numpy delete and enumerate
Python 3.9
I have a numpy ndarray of strings. The actual array has thousands of strings, but let's say:
words_master = ['CARES' 'BARES' 'CANES' 'TARES' 'PARES' 'BANES' 'BALES' 'CORES' 'BORES'
'MARES'...

Andrew M
Votes: 0
Answers: 4
Why some methods of ndarray are present as an equivalent function in top-level of numpy?
I see there is ndarray.reshape and also numpy.reshape and the documentation mentions them to be equivalent. Similarly for ravel. If that is the case, why did they make unnecessary duplicate of these m...
Neo Anderson
Votes: 0
Answers: 1