'Code Works Sometimes, Other Times Gives: TypeError: cannot unpack non-iterable NoneType object

I am trying to write a random forest algorithm, but I am having trouble making a decision tree. The code runs fine some of the time, but then it will give me a TypeError: cannot unpack non-iterable NoneType object error some of the time.

I tried running the code using a different dataset and it worked perfectly fine. I am not sure what that means.

Here is my code: https://colab.research.google.com/drive/1eXdXWNaQ7Cilc9wQqhy9_dh7r7dNIMj3?usp=sharing

and then the data set: https://drive.google.com/file/d/1CqucTocxjEuawmMByF10rYg-5uCfT_ud/view?usp=sharing



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source