Decision Tree split error
def __find_best_split(X, Y, i):
best_split = {}
for column in X:     
    information_gain,split = (2,3)#self.__find_best_split_for_column(column)
    if not split: continue
    if not best_split or best_split["information_gain"] &lt;information_gain:
        best_split = {"split":split,"col":column,"information_gain":information_gain}
C= (best_split)
return C


I ran this code in python 3.7 and it gave me the correct output: {'split': 3, 'col': 'a', 'information_gain': 2}. Also as pointed out by Ben Reiniger, it should be if not split: continue rather than if split: continue. In your case based on the indentation, C should never get defined or if indented properly, it should give empty dictionary. In both the scenario, getting error assert type(C) == dict does not makes sense.