I have a data set that I group by items (ex. "widgets") and then run a correlation. The result gives a matrix for each widget but since I have a large number of them it makes it very hard to read any exported CSVs.
Is there a simple way to convert the matrix into columns representing the "column vs column" values? This is further confounded by the fact that some of the columns that go into the correlation are definitely not correlated.
I tried the answer from Pandas Correlation Groupby but it keeps the columns as an additional index (at least I think that is the correct terminology as I am new to pandas).
Example Correlation (with made up numbers):
+--------------------------------------+
| 1 Name Color Material MTTF |
+--------------------------------------+
| Name 1 0.2 0.4 0.01 |
| Color 0.2 1 0.03 0.08 |
| Material 0.4 0.3 1 0.75 |
| MTTF 0.01 0.08 0.75 1 |
+--------------------------------------+
| 2 Name Color Material MTTF |
+--------------------------------------+
| ... Name Color Material MTTF |
+--------------------------------------+
What I would want for CSV output would be like the following (note I've removed columns where the correlation doesn't make sense):
+-------------------------------------------+
| Material vs Color Material vs MTTF |
+-------------------------------------------+
| 1 0.03 0.75 |
| 2 0.15 0.80 |
| ... |
+-------------------------------------------+