ruby - Removing all elements of a column in a two-dimensional array -


i have array:

arr = [["a","b","c"],[2,3,5],[3,6,8],[1,3,1]] 

which representing prawn-table containing columns "a", "b", , "c".

how remove entire column "c" values, 5, 8, 1?

maybe there useful hints in "create two-dimensional arrays , access sub-arrays in ruby" , "difficulty modifying 2 dimensional ruby array" can't transfer them problem.

just out of curiosity sake here approach (one-liner):

arr.transpose[0..-2].transpose 

Comments

Popular posts from this blog

user interface - Python attempting to create a simple gui, getting "AttributeError: 'MainMenu' object has no attribute 'intro_screen'" -

jquery - Common JavaScript snippet to share files on Google Drive, Dropbox, Box.net or SkyDrive -

Android Gson.fromJson error -