ValueError: cannot reindex from a duplicate axis
<p>Let's say I have two dataframes:</p>

<pre><code>import string
import pandas as pd

d = {'one': pd.Series(range(26), index = list(string.ascii_lowercase)),
     'two': pd.Series([1., 2., 3., 4.], index = ['a', 'b', 'c', 'd'])}
df = pd.DataFrame(d)

d2 = {'one': pd.Series(range(10), index = range(11, 21))}
df2 = pd.DataFrame(d2)
</code></pre>

<p>Now, I have a list of indices:</p>

<pre><code>np.random.seed(12)
i = np.random.choice(np.arange(11, 21), size = 26)
</code></pre>

<p>Now I want to join <code>df2</code> with <code>df1</code> based on <code>i</code>.</p>

<pre><code>df['new_col'] = df2['one'][i]
</code></pre>

<p>But I get the above mentioned error. One way to work around this is to add <code>i</code> directly to <code>df1</code>, and create a column called <code>i</code> in <code>df2</code> to represent the <code>index</code>, and then do a <code>merge</code> but it seems very inefficient. Is there a better way to do this?</p>

<p>I know there are a few questions with the same title, but none of them had anything helpful for my case.</p>