I create a pivot table like that below:
I store the values in a matrix and apply a certain function to the matrix. The outputs of the function are the indexes of some rows and columns of the matrix (let's suppose that the function outputs are the squared rows and columns).Now I need to associate the corresponding row and column names from the pivot (e.g. A, D, X, Z).I tried
row_name = piv.index[row_idx]
with row_idx defined in the function file, but it tells me that row_idx is not defined.How can I solve this issue?