class_docstr: Estimate effect of treatment by stratifying the data into bins with
  identical common causes.
  
  Straightforward application of the back-door criterion.
  
  Supports additional parameters as listed below.
code: def _get_strata(
      self, data: pd.DataFrame, num_strata, clipping_threshold
  ):
      # sort the dataframe by propensity score
      # create a column 'strata' for each element that marks what strata it belongs to
      num_rows = data[self._target_estimand.outcome_variable[0]].shape[
          0
      ]
      data["strata"] = (
          (
              data[self.propensity_score_column].rank(ascending=True)
              / num_rows
          )
          * num_strata
      ).round(0)
      # for each strata, count how many treated and control units there are
      # throw away strata that have insufficient treatment or control
  
      data["dbar"] = (
          1 - data[self._target_estimand.treatment_variable[0]]
      )  # 1-Treatment
      data["d_y"] = (
          data[self._target_estimand.treatment_variable[0]]
          * data[self._target_estimand.outcome_variable[0]]
      )
      data["dbar_y"] = (
          data["dbar"] * data[self._target_estimand.outcome_variable[0]]
      )
      stratified = data.groupby("strata")
      clipped = stratified.filter(
          lambda strata: min(
              strata.loc[
                  strata[self._target_estimand.treatment_variable[0]]
                  == 1
              ].shape[0],
              strata.loc[
                  strata[self._target_estimand.treatment_variable[0]]
                  == 0
              ].shape[0],
          )
          > clipping_threshold
      )
      self.logger.debug(
          "After using clipping_threshold={0}, here are the number of data points in each strata:\n {1}".format(
              clipping_threshold,
              clipped.groupby(
                  [
                      "strata",
                      self._target_estimand.treatment_variable[0],
                  ]
              )[self._target_estimand.outcome_variable].count(),
          )
      )
      if clipped.empty:
          raise ValueError(
              "Method requires strata with number of data points per treatment > clipping_threshold (={0}). No such strata exists. Consider decreasing 'num_strata' or 'clipping_threshold' parameters.".format(
                  clipping_threshold
              )
          )
      return clipped
  
file_path: dowhy/dowhy/causal_estimators/propensity_score_stratification_estimator.py
imports: from typing import Any, List, Optional, Union
  import pandas
  from dowhy.causal_estimator import CausalEstimate, CausalEstimator
  from dowhy.causal_estimators.propensity_score_estimator import PropensityScoreEstimator
  from dowhy.causal_identifier import IdentifiedEstimand
label_desc: Use image node_id 4 for calling the PropensityScoreStratificationEstimator obj's underlying member method code with example usage: obj._get_strata(data, num_strata, clipping_threshold) and returns: clipped