Question: We are using Oracle 11.

In our CASE WHEN statement, I need to check if the number of days between the 2 dates are > 3 business days (so excluding weekends and holidays).

So, if 

Date1 = 1/21/19 (Monday)

Date2 = 1/18/19 (Friday)

The number of business days in between Date1 and Date2 is 1 day, not 3 days.

```
CASE WHEN TO_DATE(SETTLEMENT_DATE, 'YYYY-MM-DD') - TO_DATE(TRADE_DATE, 
'YYYY-MM-DD')  > 3  THEN 0  --> this includes weekend and holidays
WHEN CODE = 1 THEN 1
WHEN CODE =2 THEN 2
ELSE 3
END AS MyColumn

```

Thank you.

Answer: 
There is a simple library called [graphviz](https://www.graphviz.org) which you can use to view your decision tree. In this you don't have to export the graphic, it'll directly open the graphic of tree for you and you can later decide if you want to save it or not. You can use it as following - 

```
import graphviz
from sklearn.tree import DecisionTreeClassifier()
from sklearn import tree

clf = DecisionTreeClassifier()
clf.fit(trainX,trainY)
columns=list(trainX.columns)
dot_data = tree.export_graphviz(clf,out_file=None,feature_names=columns,class_names=True)
graph = graphviz.Source(dot_data)
graph.render("image",view=True)
f = open("classifiers/classifier.txt","w+")
f.write(dot_data)
f.close()

```

because of view = True your graphs will open up as soon as they're rendered but if you don't want that and just want to save graphs, you can use view = False

Hope this helps
There are 4 methods which I'm aware of for plotting the scikit-learn decision tree:

* print the text representation of the tree with `sklearn.tree.export_text` method
* plot with `sklearn.tree.plot_tree` method (`matplotlib` needed)
* plot with `sklearn.tree.export_graphviz` method (`graphviz` needed)
* plot with `dtreeviz` package (`dtreeviz` and `graphviz` needed)

You can find a comparison of different visualization of sklearn decision tree with code snippets in this blog post: [link](https://mljar.com/blog/visualize-decision-tree/).

When using Jupiter notebook, remember to display the variable with plot. Example for `dtreeviz`:

```py
from dtreeviz.trees import dtreeviz # remember to load the package

viz = dtreeviz(clf, X, y,
                target_name="target",
                feature_names=iris.feature_names,
                class_names=list(iris.target_names))

viz # display the tree

```