Pandas concat dictionary to dataframe
<p>I have an existing dataframe and I'm trying to concatenate a dictionary where the length of the dictionary is different from the dataframe</p>

<pre><code>&gt;&gt;&gt; df
         A        B        C
0  0.46324  0.32425  0.42194
1  0.10596  0.35910  0.21004
2  0.69209  0.12951  0.50186
3  0.04901  0.31203  0.11035
4  0.43104  0.62413  0.20567
5  0.43412  0.13720  0.11052
6  0.14512  0.10532  0.05310
</code></pre>

<p>and </p>

<pre><code>test = {"One": [0.23413, 0.19235, 0.51221], "Two": [0.01293, 0.12235, 0.63291]}
</code></pre>

<p>I'm trying to add <code>test</code> to <code>df</code>, while changing the keys to <code>"D"</code> and <code>"C"</code> and I've had a look at </p>

<p><a href="http://pandas.pydata.org/pandas-docs/stable/merging.html" rel="noreferrer">http://pandas.pydata.org/pandas-docs/stable/merging.html</a> and 
<a href="http://pandas.pydata.org/pandas-docs/stable/generated/pandas.concat.html" rel="noreferrer">http://pandas.pydata.org/pandas-docs/stable/generated/pandas.concat.html</a> </p>

<p>which indicates that I should be able to concatenate the dictionary to the dataframe</p>

<p>I've tried:</p>

<pre><code>pd.concat([df, test], axis=1, ignore_index=True, keys=["D", "E"])
pd.concat([df, test], axis=1, ignore_index=True)
</code></pre>

<p>but I'm not having any luck, the result I'm trying to achieve is </p>

<pre><code>df
         A        B        C        D        E
0  0.46324  0.32425  0.42194  0.23413  0.01293  
1  0.10596  0.35910  0.21004  0.19235  0.12235
2  0.69209  0.12951  0.50186  0.51221  0.63291
3  0.04901  0.31203  0.11035      NaN      NaN
4  0.43104  0.62413  0.20567      NaN      NaN 
5  0.43412  0.13720  0.11052      NaN      NaN
6  0.14512  0.10532  0.05310      NaN      NaN
</code></pre>