I have an ndarray created by a cKDTree, like this:
idx = array([[2941, 4837, 3593],
[ 323, 3209, 3649]])
and I'd like to use that to create a pandas DataFrame using those as indices to another data frame that has some other symbols, for example:
2941, A
4837, B
3593, C
323, D
3209, E
3649, F
And, using something like gdf = pd.DataFrame(idx) I'd like to have a DataFrame
idx_0 idx_1 idx_2
0 A B C
1 D E F
instead of
idx_0 idx_1 idx_2
0 2941 4837 3593
1 323 3209 3649
How do I do that with a multidimensional array? df.loc[idx] won't work.