How to calculate the entropy of distribution with or without a given plot?

#1

I am currently studying about Decision tree algorithm and while studying it I found that Entropy is a measure which controls how decision tree decides how to split data

Entropy - Control how decision tree decides where to split data.

In the given figure, the right plot with orange box has zero entropy and left orange box does not have zero entropy.I want to know how we can calculate the entropy by just looking the distribution.

I also want to know the argument in python which helps in calculating the entropy of each class.

How is the data divided into splits in decision tree algorithm?
#2

@harry - You can relate entropy of distribution with the impurity of a distribution. The orange box on the right has zero impurity ( it means that there is only one type distribution ), so we can say that it has zero impurity and vice- verse for the left plot.

In python, we can change criterion parameters which control the entropy of a decision tree.

Hope this helps!

Regards,
Hinduja