Q:

Pandas dataframe from nested dictionary to melted data frame

I converted a nested dictionary to a Pandas DataFrame which I want to use as to create a heatmap. 
The nested dictionary is simple to create:
>>>df = pandas.DataFrame.from_dict(my_nested_dict)
>>>df

    93  94  95  96  97  98  99  100 100A     100B   ... 100M    100N    100O    100P    100Q    100R    100S    101 102 103
A   465 5   36  36  28  24  25  30  28  32  ... 28  19  16  15  4   4   185 2   7   3
C   0   1   2   0   6   10  8   16  23  17  ... 9   5   6   3   4   2   3   3   0   1
D   1   0   132 6   17  22  17  25  21  25  ... 12  16  21  7   5   18  2   1   296 0
E   4   0   45  10  16  12  10  15  17  18  ... 4   9   7   10  5   6   4   3   129 0
F   1   0   4   17  14  11  8   11  24  9   ... 17  8   8   12  7   3   1   98  0   1
G   2   10  77  55  71  52  65  39  37  45  ... 46  65  23  9   18  171 141 2   31  0
H   0   5   25  12  18  8   12  7   10  6   ... 8   11  6   4   4   5   2   2   1   8
I   1   8   7   23  26  35  36  34  31  38  ... 19  7   2   37  7   3   0   3   2   26
K   0   42  3   24  5   15  17  11  6   8   ... 9   10  9   8   9   2   1   28  0   0
L   3   0   19  50  32  33  21  26  26  18  ... 19  44  122 11  10  7   5   17  2   5
M   0   1   1   3   1   13  9   12  12  8   ... 20  3   1   1   0   1   0   191 0   0
N   0   5   3   12  8   15  12  13  21  9   ... 18  10  10  11  12  26  3   0   5   1
P   1   1   19  50  39  47  42  43  39  33  ... 48  35  15  16  59  2   13  6   0   160
Q   0   2   16  15  12  13  10  13  16  5   ... 11  6   3   11  4   1   0   1   6   28
R   0   380 17  66  54  41  51  32  24  29  ... 43  44  16  17  14  6   2   126 4   5
S   14  18  27  42  55  37  41  42  45  70  ... 47  31  64  14  42  18  8   3   1   5
T   4   13  17  32  29  37  33  32  30  38  ... 87  79  19  125 96  11  11  7   7   3
V   4   9   36  24  39  40  35  45  42  52  ... 20  12  12  9   8   5   0   6   7   209
W   0   0   1   6   6   8   4   7   7   9   ... 6   6   1   1   1   1   27  1   0   0
X   0   0   0   0   0   0   0   0   0   0   ... 0   4   0   0   0   0   0   0   0   0
Y   0   0   13  17  24  27  44  47  41  31  ... 29  76  139 179 191 208 92  0   2   45

I like to use ggplot to make heat maps which would just be this data frame. However, the dataframes needed for ggplot are a little different. I can use the pandas.melt function to get close, but I'm missing the row titles.
 >>>mdf = pandas.melt(df)
 >>>mdf

   variable value
0   93  465
1   93  0
2   93  1
3   93  4
4   93  1
5   93  2
6   93  0
7   93  1
8   93  0
...
624 103 5
625 103 3
626 103 209
627 103 0
628 103 0
629 103 45

The easiest thing to make this dataframe would be is to add the value of the amino acid so the DataFrame looks like:
   variable value rowvalue
0   93  465  A
1   93  0  C
2   93  1  D
3   93  4  E
4   93  1  F
5   93  2  G
6   93  0  H
7   93  1  I
8   93  0  K

That way I can take that dataframe and put it right into ggplot:
>>> from ggplot import *
>>> ggplot(new_df,aes("variable","rowvalue")) + geom_tile(fill="value")

would produce a beautiful heatmap. How do I manipulate the nested dictionary dataframe in order to get the dataframe at the end. If there is a more efficient way to do this, I'm open for suggestions, but I still want to use ggplot2.
Edit -
I found a solution but it seems to be way too convoluted. Basically I make the index into a column, then melt the data frame.
>>>df.reset_index(level=0,inplace=True)
>>>pandas.melt(df,id_vars['index']
index   variable    value
0   A   93  465
1   C   93  0
2   D   93  1
3   E   93  4
4   F   93  1
5   G   93  2
6   H   93  0
7   I   93  1
8   K   93  0
9   L   93  3
10  M   93  0
11  N   93  0
12  P   93  1
13  Q   93  0
14  R   93  0
15  S   93  14
16  T   93  4

A:

if i understand  properly your question, i think you can simply do the following :
mdf = pandas.melt(df)
mdf['rowvalue'] = df.index
mdf
  variable value rowvalue
0   93  465  A
1   93  0  C
2   93  1  D
3   93  4  E
4   93  1  F
5   93  2  G
6   93  0  H
7   93  1  I
8   93  0  K

