Did you mean to use
sklearn
, instead of
sk.learn
? That is something that this error code is telling you.
Try this,
import pandas as pd
from sklearn import tree
model = tree.DecisionTreeClassifier()
This will help you if you have scikit-learn installed. If you get issue on
sklearn
, then you need to install the framework first;
python - ModuleNotFoundError: No module named 'sklearn' - Stack Overflow[
^]
See more on the
DecisionTreeClassifier[
^].
See an example of this usage here,
1.10. Decision Trees — scikit-learn 0.21.3 documentation[
^].
Before, I close this answer, here is a food for thought: Can you make it work with,
from sklearn.tree import DecisionTreeClassifier
?