I am using Pandas to merge two dataframes obtained from Psychopy.
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)
This is the error I get:
type object argument after * must be an iterable, not itertools.imap
I checked what type of dataframes I have:
print(type(df))
print(type(df2))
This is the result:
<class 'pandas.core.frame.DataFrame'> #df
<class 'pandas.core.frame.DataFrame'> #df2
Following some info found in other posts, I also tried to convert df
and df2
into tuples and then doing the merge
.
df = df.apply(tuple)
df2 = df2.apply(tuple)
df3 = pd.merge(df2,df)
Then I get a different error
can not merge DataFrame with instance of type <class 'pandas.core.series.Series'>
Do you know what could be a way to merge these two dataframes?