yarden
unread,Jan 19, 2012, 1:24:22 PM1/19/12Sign in to reply to author
Sign in to forward
You do not have permission to delete messages in this group
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to pystat...@googlegroups.com
Thanks for your reply. I thought join was the right method but I was unable to get it to work. Suppose we have:
>>> df1
col1 id
0 -0.3149 a
1 0.3524 b
2 -0.6351 c
>>> df2
col2 id
0 0.1234 a
1 0.4563 d
# Attempt to join using "id" key
>>> df1.join(df2, on="id")
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/Library/Frameworks/EPD64.framework/Versions/7.0/lib/python2.7/site-packages/pandas/core/frame.py", line 2605, in join
return self._join_on(other, on, how, lsuffix, rsuffix)
File "/Library/Frameworks/EPD64.framework/Versions/7.0/lib/python2.7/site-packages/pandas/core/frame.py", line 2628, in _join_on
lsuffix=lsuffix, rsuffix=rsuffix)
File "/Library/Frameworks/EPD64.framework/Versions/7.0/lib/python2.7/site-packages/pandas/core/internals.py", line 789, in join_on
this, other = self._maybe_rename_join(other, lsuffix, rsuffix)
File "/Library/Frameworks/EPD64.framework/Versions/7.0/lib/python2.7/site-packages/pandas/core/internals.py", line 757, in _maybe_rename_join
raise Exception('columns overlap: %s' % intersection)
Exception: columns overlap: [id]
Any idea what is wrong with this? Thanks, --Yarden