Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Exception Joining DataFrames and Series #367

Closed
CRP opened this issue Nov 15, 2011 · 2 comments
Closed

Exception Joining DataFrames and Series #367

CRP opened this issue Nov 15, 2011 · 2 comments
Labels
Milestone

Comments

@CRP
Copy link
Contributor

CRP commented Nov 15, 2011

In [23]: a=DataFrame(randn(5,2),index=[1,2,3,6,7],columns=['a','b'])

In [24]: b=Series([6,7,8,9],index=[0,1,2,3],name='c')

In [25]: c=Series([6,7,8,9],name='c')

In [26]: a
Out[26]:
a b
1 -0.268 -0.1305
2 0.2243 0.4644
3 0.4767 -0.5677
6 0.1806 0.6276
7 0.9767 0.3687

In [27]: b
Out[27]:
0 6
1 7
2 8
3 9
Name: c

In [28]: c
Out[28]:
0 6
1 7
2 8
3 9
Name: c

In [29]: a.join(b,how='outer')
Out[29]:
a b c
0 NaN NaN 6
1 -0.268 -0.1305 7
2 0.2243 0.4644 8
3 0.4767 -0.5677 9
6 0.1806 0.6276 NaN
7 0.9767 0.3687 NaN

In [30]: a.join(c,how='outer')

ValueError Traceback (most recent call last)
/Users/c.prinoth/ in ()
----> 1 a.join(c,how='outer')

/Library/Python/2.6/site-packages/pandas/core/frame.pyc in join(self, other, on, how, lsuffix, rsuffix)
2303 return self._join_on(other, on, how, lsuffix, rsuffix)
2304 else:
-> 2305 return self._join_index(other, how, lsuffix, rsuffix)
2306
2307 def _join_on(self, other, on, how, lsuffix, rsuffix):

/Library/Python/2.6/site-packages/pandas/core/frame.pyc in _join_index(self, other, how, lsuffix, rsuffix)
2340
2341 # this will always ensure copied data

-> 2342 merged_data = join_managers(thisdata, otherdata, axis=1, how=how)
2343 return self._constructor(merged_data)
2344

/Library/Python/2.6/site-packages/pandas/core/internals.pyc in join_managers(left, right, axis, how, copy)
991
992 def join_managers(left, right, axis=1, how='left', copy=True):
--> 993 op = _JoinOperation(left, right, axis=axis, how=how)
994 return op.get_result(copy=copy)
995

/Library/Python/2.6/site-packages/pandas/core/internals.pyc in init(self, left, right, axis, how)
1015 (self.join_index,
1016 self.lindexer,
-> 1017 self.rindexer) = laxis.join(raxis, how=how, return_indexers=True)
1018
1019 # do NOT sort

/Library/Python/2.6/site-packages/pandas/core/index.pyc in join(self, other, how, return_indexers)
491 if self.is_monotonic and other.is_monotonic:
492 return self._join_monotonic(other, how=how,
--> 493 return_indexers=return_indexers)
494
495 if how == 'left':

/Library/Python/2.6/site-packages/pandas/core/index.pyc in _join_monotonic(self, other, how, return_indexers)
530 join_index = Index(join_index)
531 elif how == 'outer':
--> 532 join_index, lidx, ridx = lib.outer_join_indexer_object(self, other)
533 join_index = Index(join_index)
534 else: # pragma: no cover

/Library/Python/2.6/site-packages/pandas/_tseries.so in pandas._tseries.outer_join_indexer_object (pandas/src/tseries.c:43677)()

ValueError: Buffer dtype mismatch, expected 'Python object' but got 'long'

@CRP
Copy link
Contributor Author

CRP commented Nov 15, 2011

forgot to add that I am using a version of pandas I got from github, file name was wesm-pandas-v0.5.0-61-gc0a89c9

@wesm
Copy link
Member

wesm commented Nov 16, 2011

Thanks Christian. Fixed in the above commit, will be part of the forthcoming 0.5.1 release

@wesm wesm closed this as completed Nov 16, 2011
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants