title: How to visualize decision tree it in python?
body: <p>I created a decision tree and tried to follow an answer(<a href="https://stackoverflow.com/questions/27817994/visualizing-decision-tree-in-scikit-learn/27818170#27818170">Visualizing decision tree in scikit-learn</a>) to visualize it in python,but still don't work:</p>
  
  <pre><code>import pandas as pd
  score_v2 = pd.read_csv("C:/TEST_RF_CSV_simple.csv",encoding = "cp950")
  
  from sklearn import datasets
  from sklearn.model_selection import train_test_split
  from sklearn.neighbors import KNeighborsClassifier
  
  score_X = score_v2
  score_y = score_v2.buy_lf
  X_train, X_test, y_train, y_test = train_test_split(
  score_X, score_y, test_size=0.3)
  
  from sklearn.tree import DecisionTreeClassifier
  tree=DecisionTreeClassifier(criterion = 'entropy', max_depth=3, 
  random_state=0)
  tree.fit(X_train, y_train)
  tree_1 = tree.fit(X_train, y_train)
  
  from sklearn.tree import export_graphviz
  dotfile = open("D:/dtree2.dot", 'w')
  tree.export_graphviz(dtree, out_file = dotfile, feature_names = 
  X.columns)
  dotfile.close()
  </code></pre>
  
  <p>my error was:</p>
  
  <pre><code>AttributeError: 'DecisionTreeClassifier' object has no attribute 
  'export_graphviz'
  </code></pre>
  
  <p>Could any masters help me with solving the problem?</p>