I am working with multiple NumPy 2-dimension arrays (matrices), and I want to get some rows, or columns, from them (same rows or columns indexes for each of the 3 matrices, each time). I was wondering if I should use dictionary or not.
If I do it with a dictionary, then each row of each matrix would be indexed by a word, and would a list of values that interest me. E.g, myDict['word'] would contain [1 5 2 49 0 2].
If I do it with an array myArray, for each i I would have an array contained within myArray[i]. E.g, myArray[5] would contain array([[1 2 4 9 1 23]]).
On these I need to implement basic get operations (get rows or get columns), some matrix multiplications but never sorting or insertions.
I know I can do it both ways, my question is mainly of performance. Which do you think would be the faster and simplier?
Thanks a lot!
myDict['myRowOfApples']and still have the fast multiplication. You'd have to duplicate the data though, having rows and columns stored in different keys of a same dict or in two different dicts, one for rows and one for columns. If performance is not critical go for readability.