How can I find the dimensions of a matrix in Python. Len(A) returns only one variable.
Edit:
close = dataobj.get_data(timestamps, symbols, closefield)
Is (I assume) generating a matrix of integers (less likely strings). I need to find the size of that matrix, so I can run some tests without having to iterate through all of the elements. As far as the data type goes, I assume it’s an array of arrays (or list of lists).
Advertisement
Answer
The number of rows of a list of lists would be: len(A)
and the number of columns len(A[0])
given that all rows have the same number of columns, i.e. all lists in each index are of the same size.