New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
No write attribute under Python 3? #136
Comments
The tests are run on Travis under both versions 2 and 3 of Python, so this is likely manipulating an instance of an object that is not a graph, but a However, I found that the inhomogeneous behavior is more complex (simple is better than complex, PEP 20), so I changed it to return a Is this how the some_graphs = ...
assert len(some_graphs) == 1, some_graphs
(graph,) = some_graphs
graph.write_pdf('iris.pdf') |
@elmerehbi did this solve the issue? |
Thank you for the reply @johnyf. You got it right, obviously if I am not mistaken. Here's the code I copied a few months ago from the scikit-learn website: from sklearn.externals.six import StringIO
import pydot
dot_data = StringIO()
tree.export_graphviz(clf, out_file=dot_data)
graph = pydot.graph_from_dot_data(dot_data.getvalue())
graph.write_pdf("iris.pdf")
from IPython.display import Image
dot_data = StringIO()
tree.export_graphviz(clf, out_file=dot_data,
feature_names=iris.feature_names,
class_names=iris.target_names,
filled=True, rounded=True,
special_characters=True)
graph = pydot.graph_from_dot_data(dot_data.getvalue())
Image(graph.create_png()) |
I have Python 3 through Anaconda.
I tried installing pydot with Anaconda but it returns the following error:
conda install pydot
So I installed it with pip:
pip install pydot
When I run either of
graph.write_pdf("iris.pdf")
orImage(graph.create_png())
I get:Actually there's no "write" attribute to use following the dot:
graph.
The text was updated successfully, but these errors were encountered: