I need to create a matrix-like structure which can be accessed by its names of the columns and rows.
'''
Misalign CPU Ret
LU_factor 0 6 21
Random 2 10 5
'''
row=["LU_factor","Random"]
col=['Misalign', 'CPU', 'Ret']
Total=[['0', '6', '21'],['2', '10', '5']]
for i in range(0,len(Total)):
for j in range(0,len(Total[i])):
print(Total[i][j],end=" ")
# Matrix[row[i]][col[j]] =Total[i][j]
#print(Matrix)
I do not know what format or data structure I should use to store above data such that I could able to access like:
Matrix["LU_factor"]["CPU"] =6
Matrix["Random"]["Ret"] = 5
I have found one solution through numpy structured array, but I am looking for the solution without using numpy. Thanks in advance.