Select column from a matrix

Print Friendly, PDF & Email
from operator import itemgetter
nested_list = [[1, 2, 3], [10, 20, 30], [100, 200, 300]]
map(itemgetter(1), nested_list)

Result: [2, 20, 200]

 

Select columns in matrix
Select columns in matrix

Found it here: http://www.gossamer-threads.com/lists/python/python/770606

Leave a Reply

Your email address will not be published. Required fields are marked *

*

code

This site uses Akismet to reduce spam. Learn how your comment data is processed.