Deleting elements from numpy array

0 votes
How can i delete 1 item numpy array?
Jun 24 in Python by Nisa
• 1,090 points

retagged Jun 25 by Kalgi 20 views

1 answer to this question.

0 votes
Use the following code:

import numpy as np
a=np.array([1,2,3,4])
b=np.delete(a,2)

OUTPUT:

array([1, 2, 4])
answered Jun 24 by Fata
• 620 points

edited Jun 25 by Kalgi

Related Questions In Python

0 votes
1 answer
+1 vote
2 answers

View onto a numpy array?

 just index it as you normally would. ...READ MORE

answered Oct 18, 2018 in Python by roberto
43 views
0 votes
1 answer

Deleting list elements

Use pop(): a = [1, 2, 3, 4] a.pop(2) print(a) Now ...READ MORE

answered Apr 23, 2018 in Python by Nietzsche's daemon
• 4,260 points
14 views
0 votes
1 answer
0 votes
1 answer

Printing a large numpy array

numpy.set_printoptions(threshold='nan') READ MORE

answered Jul 20, 2018 in Python by Nietzsche's daemon
• 4,260 points
84 views
0 votes
1 answer

How to save Numpy array as image in python?

If you have matplotlib, you can do: import ...READ MORE

answered Nov 16, 2018 in Python by Nymeria
• 3,500 points
1,078 views
+1 vote
2 answers

how can i count the items in a list?

Syntax :            list. count(value) Code: colors = ['red', 'green', ...READ MORE

answered Jul 6 in Python by Neha
• 330 points

edited Jul 8 by Kalgi 131 views
+4 votes
6 answers