Inconsistent behaviour with pd.Timestamp ?

Hi,

this behavior puzzled me but I am unsure of it is my ignorance or really something wrong.

My pandas installation is a per latest conda install.  

tradf.info()
    
    <class 'pandas.core.frame.DataFrame'>
    MultiIndex: 100000 entries, (2, 2016-09-09 00:00:00, 2016-09-14 00:00:00) to (26123, 2016-11-18 00:00:00, 2016-12-18 00:00:00)
    Data columns (total 9 columns):
    payment_method_id         100000 non-null int16
    payment_plan_days         100000 non-null int16
    plan_list_price           100000 non-null int16
    actual_amount_paid        100000 non-null int16
    is_auto_renew             100000 non-null bool
    transaction_date          100000 non-null datetime64[ns]
    membership_expire_date    100000 non-null datetime64[ns]
    is_cancel                 100000 non-null bool
    dis                       89012 non-null timedelta64[ns]
    dtypes: bool(2), datetime64[ns](2), int16(4), timedelta64[ns](1)
    memory usage: 4.3 MB

index is a multiindex with idx (int), transaction_date_i(datetime64[ns]),membership_expire_date_i(datetime64[ns])
dataframe is sorted by idx, transaction_date_i and membership_expire_date_i. The index is sorted.

        print(tradf.loc[(165,"2017-02-01","2017-03-01"),:].membership_expire_date==pd.Timestamp("2017-03-01"))
    print(tradf.loc[(165,"2017-02-01","2017-03-01"),:].membership_expire_date=="2017-03-01")

See no casting needed as expected 

    idx  transaction_date_i  membership_expire_date_i
    165  2017-02-01          2017-03-01                  True
    Name: membership_expire_date, dtype: bool
    idx  transaction_date_i  membership_expire_date_i
    165  2017-02-01          2017-03-01                  True
    Name: membership_expire_date, dtype: bool

However this fails

    print(tradf.groupby(level="idx").apply(
         lambda x :  x.iloc[-1].membership_expire_date==pd.Timestamp("2017-03-01")).loc[165])
    print(tradf.groupby(level="idx").apply(
         lambda x :  x.iloc[-1].membership_expire_date=="2017-03-01").loc[165])

    True
    False



In the first groupby the timestamp in string format is not interpreted. Casting it to Timestamp, works.

shouldn't be the same behavior ??

Cheers

JC
