Skip to content

Mrt M

My Blog

Categories

  • Android
  • asciidoc
  • Configuration
  • Fedora
  • Gnome Shell
  • Gtk
  • How to
  • Joomla!
  • Latex
  • LibreOffice
  • Mendeley
  • Not working
  • NumPy
  • php
  • Programming
  • Python
  • SBML
  • Scipy
  • Ubuntu
  • Uncategorized
  • web

rekl1

Hosting

area.lv

Recent Posts

  • Scientific setup on fresh Fedora 23 installation December 2, 2015
  • How to upgrade SciPy on Fedora 23 October 19, 2015
  • How to play encrypted DVDs on Fedora 22 September 8, 2015
  • Things to do after fresh Fedora 22 installation June 8, 2015
  • How to upgrade SciPy on Fedora 22 May 18, 2015
  • How to delete columns in numpy.array March 9, 2015
  • scipy.odr.odrpack.odr_error: number of observations do not match March 9, 2015
  • scipy error: ValueError: setting an array element with a sequence March 9, 2015
  • Python: Select column from a matrix February 9, 2015
  • Postgresql EESTERROR invalid byte sequence for encoding “UTF8”: 0xff July 30, 2014
  • Alternating row color in Calc for LibreOffice July 22, 2014
  • CSS 100% width minus paddings, margins and border July 17, 2014
  • Configure LightTable editor so it behaves more like SublimeText July 3, 2014
  • I Need a Website. Now What? June 27, 2014
  • Joomla 3 pagination localisation June 20, 2014

rekl3

Archives

  • December 2015
  • October 2015
  • September 2015
  • June 2015
  • May 2015
  • March 2015
  • February 2015
  • July 2014
  • June 2014
  • March 2014
  • January 2014
  • November 2013
  • September 2013
  • August 2013
  • July 2013
  • May 2013
  • April 2013
  • October 2012
  • September 2012
  • January 2012

rekl4

Me on stackoverflow

profile for MartinsM at Stack Overflow, Q&A for professional and enthusiast programmers

Web courses in Riga

riga_courses_baner

Category: NumPy

How to 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(a, s_[1:3], axis=1) # remove columns 1 and 2
output: array([[ 0, 3], [ 4, 7], [ 8, 11], [12, 15]])

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

Posted on March 9, 2015Categories NumPy, Python