-
-
Notifications
You must be signed in to change notification settings - Fork 18.8k
Description
pandas version: 0.8.2.dev-742d7fb
import pandas
import pandas.util.testing as put
index = put.makeDateIndex(4)
index.isin(index) # returns array([False, False, False, False], dtype=bool)
It works fine with pandas 0.7.3, i.e. it returns an array of True instead. This works fine as well with a pandas.Int64Index. index.isin(index)
just calls pandas.lib.ismember(index._array_values(), set(index))
but I am afraid I lack the skills to understand what goes wrong in the cython code.
Just for some background, the original problem I bumped into:
import numpy as np
import pandas
ts = pandas.TimeSeries(data=[1,2,3], index=[ np.datetime64(x) for x in ['2000', '2000', '2002'] ])
ts.ix[ts.index] # returns an empty timeseries whereas ts[ts.index] works fine
I tracked it down to ts.ix._get_item_iterable
which has a special case for when the index has duplicates which use pandas.TimeSeries.isin.
As an aside it looks like pandas.core.common._asarray_tuplesafe(index) is wrong when using numpy 1.6 so that ts.ix[ts.index] still would return an empty array if this bug was fixed, but I guess that's a numpy 1.6 datetime64 bug which I have seen mentioned in a few other places.