‘20210708’ should be interpreted as 8th of July 2021 by pandas when pd.to_datetime has been applied.
However, try applying the same function on 20210708.0
Well that’s the problem with sometimes not showing a bug but code still runs giving an incorrect output. Such a case is detrimental for a software package. So while importing datetime columns from a source such as CSV, make sure to import column as string that has values like 20210708. Also check pd.to_datetime parameters once, to make sure none of the default parameters are creating a problem.