ISIN function does not work for dates

后端 未结 4 1867
孤城傲影
孤城傲影 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:05

    I have the same version of pandas, and @DSM's answer was helpful. Another workaround would be to use the apply method:

    >>> df.Dates.apply(lambda date: date in [pd.Timestamp('2013-01-04')])
    
    0    False
    1    False
    2     True
    Name: Dates, dtype: bool
    

提交回复
热议问题