Search
 
SCRIPT & CODE EXAMPLE
 

PYTHON

remove element from np array

import numpy as np

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

new_a = np.delete(a, index)

print(new_a) #Prints `[1, 2, 5, 6, 8, 9]`
Comment

python numpy delete element from array

array = np.delete(array, 2)
Comment

python remove one element from numpy array

numpy.delete(a, index)
Comment

Python NumPy delete Function Example Deletion from 1D array

# welcome to softhunt.net
# Python Program illustrating
# numpy.delete()

import numpy as np

#Working on 1D
arr = np.arange(5)
print("arr : 
", arr)
print("Shape : ", arr.shape)

# deletion from 1D array

object = 2
a = np.delete(arr, object)
print("
deleteing {} from array : 
 {}".format(object,a))
print("Shape : ", a.shape)

object = [1, 2]
b = np.delete(arr, object)
print("
deleteing {} from array : 
 {}".format(object,a))
print("Shape : ", a.shape)
Comment

PREVIOUS NEXT
Code Example
Python :: Program to Compute LCM 
Python :: python calculator file size to megabytes 
Python :: python program to print the fibonacci sequence 
Python :: itertools .cycle() 
Python :: remove character from string pandas 
Python :: pytohn reset all dictionary values to 0 
Python :: difference between method and function in pyhon 
Python :: tkinter delete toplevel 
Python :: how to make a leaderboard in python 
Python :: at=error code=h10 desc= app crashed python flask 
Python :: keyword python 
Python :: adding number in set in python 
Python :: split stringg to columns python 
Python :: login required django 
Python :: beautifulsoup check if text exists 
Python :: django templates 
Python :: python array looping 
Python :: static files in django 
Python :: django queryset to list 
Python :: make int into string python 
Python :: python pandas read_excel 
Python :: python unittest discover 
Python :: pandas separator are multiple spaces 
Python :: Get the square root of a number in Python 
Python :: ip validity checker python 
Python :: how to declare np datetime 
Python :: python enumerate for loop 
Python :: polish notation python 
Python :: python get 1st arg 
Python :: django admin create project 
ADD CONTENT
Topic
Content
Source link
Name
9+2 =