Answers for "numpy deleting rows and columns woith slice"

1

python numpy array delete multiple columns

a = [[ 0  1  2  3], 
     [ 4  5  6  7], 
     [ 8  9 10 11]]

print(np.delete(a, [0, 3], 1))

# [[ 1  2]
#  [ 5  6]
#  [ 9 10]]
Posted by: Guest on November-27-2020
0

delete values with condition in numpy

a = np.array([1,2,3,4,5,6])

out = np.logical_not(a < 3) 

print(out) # array([False, False,  True,  True,  True,  True])
print(a[out]) # array([3, 4, 5, 6])
Posted by: Guest on August-10-2020

Python Answers by Framework

Browse Popular Code Answers by Language