Your code might work with data at a certain state but might not work if your data changes. How do you detect the change in data before running into errors or encounter the drop in your model performance? That is when Schema comes in handy.
Below is the code snippet I used to validate the datatypes and the range of the values in a column. If this is what you are looking for, check out my article on how to use Schema here.