<p dir="auto">cc <a class="team-mention js-team-mention notranslate" data-error-text="Failed to load team members" data-id="2157062" data-permission-text="Team members are private" data-url="/orgs/pandas-dev/teams/pandas-core/members" data-hovercard-type="team" data-hovercard-url="/orgs/pandas-dev/teams/pandas-core/hovercard" href="https://github.com/orgs/pandas-dev/teams/pandas-core">@pandas-dev/pandas-core</a></p>
<p dir="auto">Targeting Friday June 8th.</p>
<p dir="auto">I am trying to merge multiple dataframe with consecutive merge operations, I want to add a suffix to the name of the newly merged column names. A simplified version of my code looks like this:</p>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="from pandas import *
f0 = DataFrame(columns=['data'], data=[1,2,3], index=['a','b','c'])
f1 = DataFrame(columns=['data'], data=[4,5,6], index=['c','b','a'])
f2 = DataFrame(columns=['data'], data=[7,8,9], index=['a','c','b'])
merged = f0
merged = merged.merge(f1, left_index=True, right_index=True, suffixes=(&quot;_0&quot;, &quot;_1&quot;))
merged = merged.merge(f2, left_index=True, right_index=True, suffixes=(&quot;&quot;, &quot;_2&quot;))
print merged.columns"><pre class="notranslate"><code class="notranslate">from pandas import *
f0 = DataFrame(columns=['data'], data=[1,2,3], index=['a','b','c'])
f1 = DataFrame(columns=['data'], data=[4,5,6], index=['c','b','a'])
f2 = DataFrame(columns=['data'], data=[7,8,9], index=['a','c','b'])
merged = f0
merged = merged.merge(f1, left_index=True, right_index=True, suffixes=("_0", "_1"))
merged = merged.merge(f2, left_index=True, right_index=True, suffixes=("", "_2"))
print merged.columns
</code></pre></div>
<p dir="auto">With pandas 0.15.2 on python 2.7 this returns:</p>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="Index([u'data_0', u'data_1', u'data'], dtype='object')"><pre class="notranslate"><code class="notranslate">Index([u'data_0', u'data_1', u'data'], dtype='object')
</code></pre></div>
<p dir="auto">while I would have expected</p>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="Index([u'data_0', u'data_1', u'data_2'], dtype='object')"><pre class="notranslate"><code class="notranslate">Index([u'data_0', u'data_1', u'data_2'], dtype='object')
</code></pre></div>