How to separate bad data records from good data?

Also, here’s a toy example for doing this using pandas. It is not implemented for sql.