Comparison between datetime and datetime64[ns] in pandas

For anyone who also stumbled across this when comparing a dataframe date to a variable date, and this did not exactly answer your question; you can use the code below.

Instead of:

self.df["date"] = pd.to_datetime(self.df["date"])

You can import datetime and then add .dt.date to the end like:

self.df["date"] = pd.to_datetime(self.df["date"]).dt.date

Leave a Comment

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)