Problem exporting to JSON and dict
Opened this issue · 0 comments
LuisGGon commented
Hello.
I have built a CHAID decision tree and I got a tree object with the code
tree_obj = tree.to_tree()
.
Afterwards, I have tried to save the tree into a dict file with the command
tree_obj.to_dict()
,
but I got the following error:
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/home/LuisG/anaconda3/lib/python3.8/site-packages/treelib/tree.py", line 964, in to_dict
tree_dict = {ntag: {"children": []}}
File "/home/LuisG/anaconda3/lib/python3.8/site-packages/CHAID/node.py", line 42, in __hash__
return hash(self.__dict__)
TypeError: unhashable type: 'dict'
Something similar happens when I tried to save the tree as a JSON file.