Delete columns in numpy.array

a=array([[ 0, 1, 2, 3], [ 4, 5, 6, 7], [ 8, 9, 10, 11], [12, 13, 14, 15]])
delete(a, s_[1:3], axis=0) # remove rows 1 and 2

output: array([[ 0, 1, 2, 3], [12, 13, 14, 15]])

delete columns in matrix with numpy.array
delete columns in matrix with numpy.array
delete(a, s_[1:3], axis=1) # remove columns 1 and 2

output: array([[ 0, 3], [ 4, 7], [ 8, 11], [12, 15]])

Solution was found here: http://stackoverflow.com/questions/1642730/how-to-delete-columns-in-numpy-array

Nguyen Vu Ngoc Tung

I love making new professional acquaintances. Don't hesitate to contact me via nguyenvungoctung@gmail.com if you want to talk about information technology, education, and research on complex networks analysis (i.e., metabolic networks analysis), data analysis, and applications of graph theory. Specialties: researching and proposing innovative business approaches to organizations, evaluating and consulting about usability engineering, training and employee development, web technologies, software architecture.

https://www.itersdesktop.com/author/nvntung/

Laisser un commentaire

Votre adresse e-mail ne sera pas publiée. Les champs obligatoires sont indiqués avec *

Ce site utilise Akismet pour réduire les indésirables. En savoir plus sur la façon dont les données de vos commentaires sont traitées.