Same code, same data, different output.

This could happen for a lot of reasons, most likely related with keeping old data in your environment while doing EDA and modeling. It's hard to know for sure without a reproducible example.

Could you ask this with a minimal REPRoducible EXample (reprex)? A reprex makes it much easier for others to understand your issue and figure out how to help.