Solved by Usama_Hasan in post #4 
              
              
                Hy @Bisma_Akram 

when you iterate over classes, your classes list contains the anomly either check this column or remove it from your dataset. It’s better if you use exception handling here.