Rename colum header from another dataframe
<p>I have two dataframes where 1, 2, 3 is the connection between the dataframes:</p>

<pre><code>              1    2    3 
2016-10-03   12   10   10 
2016-10-04   4     4    5 
......

and
     name    year
1   apple    2001
2   lemon    2002
3   kiwi     1990
</code></pre>

<p>The end result should be:</p>

<pre><code>              apple    lemon    kiwi 
2016-10-03       12       10      10 
2016-10-04        4        4       5 
......
</code></pre>

<p>I can't figure out how to do this. </p>

<p>You can use <a href="http://pandas.pydata.org/pandas-docs/stable/generated/pandas.DataFrame.rename.html" rel="nofollow"><code>rename</code></a>, which does not require the two DataFrames to have the keys in the same order:</p>

<pre><code>df1 = df1.rename(columns=df2['name'])
</code></pre>

python pandas dataframe