How does the class weight parameter work in sklearn RandomForestClassifier?
When working with RandomForestClassifier,  impurity (Gini or Entropy) is used to measure how mixed the groups of samples are given a split within your tree. This calculation can be biased as it depends on the distribution of your y variable.
If your y distribution is unbalanced, the impurity measurements will be biased as well. Therefore, to counter that effect, you can use the class_weight parameter to adjust those measurements so that the majority class is not favored.
The effect of the class weights parameter internally in the algorithm