I have a dataframe of dates:
>>> d.head()
Out[55]:
0 2010-06-01
1 2010-06-02
2 2010-06-03
3 2010-06-04
4 2010-06-07
dtype: datetime64[ns]
I am not able to check whether a given date in contained in it:
>>> d.iloc[1]
Out[59]: Timestamp('2010-06-02 00:00:00')
>>> d.iloc[1] in d
Out[60]: False
>>> np.datetime64(d.iloc[1]) in d
Out[61]: False
>>> d.iloc[1] in pd.to_datetime(d)
Out[62]: False
>>> pd.to_datetime(d.iloc[1]) in pd.to_datetime(d)
Out[63]: False
what's the best to check this?
to answer some of the comments below:
Using values doesnt solve it:
>>> d.iloc[1] in d.values
Out[69]: False
I dont think it is a matter of iloc returning row not value
>>> x= pd.Timestamp('2010-6-2')
>>> x
Out[72]: Timestamp('2010-06-02 00:00:00')
>>> x in d
Out[73]: False
>>> x in pd.to_datetime(d)
Out[74]: False
>>> x in d.values
Out[75]: False