You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The problem is not that the columns cannot be datetime, but rather that strings and datetimes cannot be compared (and thus the resulting columns cannot be ordered). So, if you have on the other hand
A = DataFrame(str_dates , index = range(2) , columns = [datetime(2012,1,1)] )
it should all work. eg,
In [16]: A = DataFrame(str_dates , index = range(2) , columns = [datetime(2012,1,1)] )
In [17]: A
Out[17]:
2012-01-01
0 20120209
1 20120222
In [18]: A.join(C, on=datetime(2012,1,1))
Out[18]:
2012-01-01 2012-02-09 2012-02-22
0 20120209 1 2
1 20120222 3 4
This is a bug in Index.union. If two indexes are monotonic but their elements are incomparable, self._inner_indexer will fail. Write a unit test with a union of these two indexes:
Wes, please have a look. Falls back on slower non-monotonic methodology in intersect on TypeError (union works fine - I think you meant intersection?).
Issue:
For DataFrameA.join( DataFrameB , on = 'somecol' ), DataFrameB can not have datetime objects as column labels
Example:
from datetime import datetime
from pandas import DataFrame
str_dates = [ '20120209' , '20120222' ]
dt_dates = [ datetime(2012,2,9) , datetime(2012,2,22)]
A = DataFrame(str_dates , index = range(2) , columns = ['aa'] )
B = DataFrame([[1,2],[3,4]] , index = str_dates , columns = str_dates)
C = DataFrame([[1,2],[3,4]] , index = str_dates , columns = dt_dates )
works = A.join( B , on = 'aa' ) # works -- extra column labels are string
fails = A.join( C , on = 'aa' ) # fails -- extra column labels are datetime
The text was updated successfully, but these errors were encountered: