Accueil / 21:59 / 21:59

Archives du mois: vendredi 28 août 2015

Delete columns in numpy.array

delete columns in matrix with 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], ...

Lire la suite...

Select column from a matrix

Select columns in matrix with numpy.array

from operator import itemgetter nested_list = [[1, 2, 3], [10, 20, 30], [100, 200, 300]] map(itemgetter(1), nested_list) Result: [2, 20, 200] Found it here: http://www.gossamer-threads.com/lists/python/python/770606

Lire la suite...