I'm executing the code below and getting the error following it -
from IPython.display import Image
from sklearn.tree import export_graphviz
from six import StringIO
import pydotplus
features = list(df.columns[:-1])
features
dot_data = StringIO()
export_graphviz(dtree, out_file=dot_data,feature_names=features,filled=True,rounded=True)
graph = pydotplus.graph_from_dot_data(dot_data.getvalue())
Image(graph.create_png())
Error-
InvocationException Traceback (most recent call last)
<ipython-input-98-1978b4285d97> in <module>
3
4 graph = pydotplus.graph_from_dot_data(dot_data.getvalue())
----> 5 Image(graph.create_png())
~\anaconda3\lib\site-packages\pydotplus\graphviz.py in <lambda>(f, prog)
1789 self.__setattr__(
1790 'create_' + frmt,
-> 1791 lambda f=frmt, prog=self.prog: self.create(format=f, prog=prog)
1792 )
1793 f = self.__dict__['create_' + frmt]
~\anaconda3\lib\site-packages\pydotplus\graphviz.py in create(self, prog, format)
2022
2023 if status != 0:
-> 2024 raise InvocationException(
2025 'Program terminated with status: %d. stderr follows: %s' % (
2026 status, stderr_output))
InvocationException: Program terminated with status: 1. stderr follows: 'C:\Users\Ankit' is not recognized as an internal or external command,
operable program or batch file.
I'm assuming it is because of my Username - Ankit Chawrai. ALthough please tell me what could be the possible solution.