Supposing I have the following matrix, either pandas or numpy:
A = np.array([[1,2,3],[4,5,6],[7,8,9]])
>>> array([[1, 2, 3],
[4, 5, 6],
[7, 8, 9]])
I am looking for a way to reshape this array to 1D and keep the index of that cell as a column name so that if the above was to be flattened, the outcome would be as such:
>>> array([['i1j1', 'i1j2', 'i1j3', 'i2j1', 'i2j2', 'i2j3', 'i3j1', 'i3j2','i3j3'],
['1', '2', '3', '4', '5', '6', '7', '8', '9']], dtype='<U4')
Many thanks.