graph.write_pdf(“iris.pdf”) AttributeError: 'list' object has no attribute 'write_pdf'

前端 未结 10 1816
深忆病人
深忆病人 2020-12-08 19:00

My code is follow the class of machine learning of google.The two code are same.I don\'t know why it show error.May be the type of variable is error.But google\'s code is sa

10条回答
  •  我在风中等你
    2020-12-08 19:21

    I think you are using newer version of python. Please try with pydotplus.

    import pydotplus
    ...
    graph = pydotplus.graph_from_dot_data(dot_data.getvalue())
    graph.write_pdf("iris.pdf")
    

    This should do it.

提交回复
热议问题