title: How to merge two dataframes with Pandas?
body: <p>I am using Pandas to merge two dataframes obtained from Psychopy. </p>
  
  <pre><code>y = ["key_resp_0.keys", "key_resp_0.rt"] #some columns I want in my final dataframe
  df = pd.DataFrame(myData)
  columns = df.columns.values.tolist() 
  df2 = df.reindex(columns = y, fill_value='')
  df3 = pd.merge(df2,df)
  </code></pre>
  
  <p>This is the error I get:</p>
  
  <pre><code>type object argument after * must be an iterable, not itertools.imap
  </code></pre>
  
  <p>I checked what type of dataframes I have:</p>
  
  <pre><code>print(type(df))
  print(type(df2))
  </code></pre>
  
  <p>This is the result:</p>
  
  <pre><code>&lt;class 'pandas.core.frame.DataFrame'&gt; #df
  &lt;class 'pandas.core.frame.DataFrame'&gt; #df2
  </code></pre>
  
  <p>Following some info found in other posts, I also tried to convert <code>df</code> and <code>df2</code> into tuples   and then doing the <code>merge</code>.</p>
  
  <pre><code>df = df.apply(tuple) 
  df2 = df2.apply(tuple)
  df3 = pd.merge(df2,df)
  </code></pre>
  
  <p>Then I get a different error</p>
  
  <pre><code>can not merge DataFrame with instance of type &lt;class 'pandas.core.series.Series'&gt;
  </code></pre>
  
  <p>Do you know what could be a way to merge these two dataframes?</p>