I have a numpy array which I want to print with python ggplot's tile. For that I need to have a DataFrame with the columns x, y, value. How can I transform the numpy array efficiently into such a DataFrame. Please consider, that the form of the data I want is in a sparse style, but I want a regular DataFrame. I tried using scipy sparse data structures like in Convert sparse matrix (csc_matrix) to pandas dataframe, but conversions were too slow and memory hungry: My memory was used up.
To clarify what I want:
I start out with a numpy array like
array([[ 1, 3, 7],
[ 4, 9, 8]])
and I would like to end up with the DataFrame
x y value
0 0 0 1
1 0 1 3
2 0 2 7
3 1 0 4
4 1 1 9
5 1 2 8