Merging dataframes on index with pandas
<p>I have two dataframes and each one has two index columns. I would like to merge them. For example, the first dataframe is the following:</p>

<pre><code>                   V1

A      1/1/2012    12
       2/1/2012    14
B      1/1/2012    15
       2/1/2012    8
C      1/1/2012    17
       2/1/2012    9
</code></pre>

<p>The second dataframe is the following:</p>

<pre><code>                   V2

A      1/1/2012    15
       3/1/2012    21             
B      1/1/2012    24
       2/1/2012    9
D      1/1/2012    7
       2/1/2012    16
</code></pre>

<p>and as result I would like to get the following:</p>

<pre><code>                   V1   V2

A      1/1/2012    12   15
       2/1/2012    14   N/A
       3/1/2012    N/A  21           
B      1/1/2012    15   24
       2/1/2012    8    9
C      1/1/2012    7    N/A
       2/1/2012    16   N/A
D      1/1/2012    N/A  7
       2/1/2012    N/A  16
</code></pre>

<p>I have tried a few versions using the <code>pd.merge</code> and <code>.join</code> methods, but nothing seems to work. Do you have any suggestions?</p>