ISIN function does not work for dates

后端 未结 4 1864
孤城傲影
孤城傲影 2020-12-06 02:56
d = {\'Dates\':[pd.Timestamp(\'2013-01-02\'),
              pd.Timestamp(\'2013-01-03\'),
              pd.Timestamp(\'2013-01-04\')],
     \'Num1\':[1,2,3],
     \'         


        
4条回答
  •  野趣味
    野趣味 (楼主)
    2020-12-06 03:19

    This worked for me.

    df['Dates'].isin(np.array([pd.Timestamp('2013-01-04')]).astype('datetime64[ns]')) 
    

    I know that it is a bit verbose. But just in case you need to make it work this would help. Refer to https://github.com/pydata/pandas/issues/5021 for more details.

提交回复
热议问题