from sklearn.datasets import load_iris
from sklearn.tree import DecisionTreeClassifier
from sklearn.model_selection import train_test_split
iris=load_iris()
X=iris.data
y=iris.target
X_train,X_test,y_train,y_test=train_test_split(X,y)
clf=DecisionTreeClassifier(ccp_alpha=0)
clf=clf.fit(X_train,y_train)
pruning_path=clf.cost_complexity_pruning_path(X_train,y_train)
print("ccp_alpha:",pruning_path['ccp_alpha'])
print("impurities:",pruning_path['impurities'])