Pandas Merge and filter
You're most likely reading in blanks. I would first make sure date_x and date_y are timestamps and replace all blanks with np.nan:
test2['date_y']=test2['date_y'].replace(' ',np.nan)test2['date_x']=pd.to_datetime(test2['date_x'])test2['date_y']=pd.to_datetime(test2['date_y'])test2_filtered=test2.loc[test2['date_y'].isnull()]
You're trying to filter strings, but it's not a string - it's a empty datetime.date
object. You need to filter by nonempty date object.
You can create a second dataframe as string type and check then:
str_test2 = test2.astype(str)filtered_test2 = test2[str_test2['date_y'] != '']
See more possible solutions here