code: def predict_expectation(self, X, ancillary_X=None):
          
          alpha_, beta_ = self._prep_inputs_for_prediction_and_return_scores(X, ancillary_X)
          v = (alpha_ * np.pi / beta_) / np.sin(np.pi / beta_)
          v = np.where(beta_ > 1, v, np.nan)
          return pd.DataFrame(v, index=_get_index(X))
docs: Predict the expectation of lifetimes, :math:`E[T | x]`.
  
          Parameters
          ----------
          X: numpy array or DataFrame
              a (n,d) covariate numpy array or DataFrame. If a DataFrame, columns
              can be in any order. If a numpy array, columns must be in the
              same order as the training data.
          ancillary_X: numpy array or DataFrame, optional
              a (n,d) covariate numpy array or DataFrame. If a DataFrame, columns
              can be in any order. If a numpy array, columns must be in the
              same order as the training data.
  
          Returns
          -------
          percentiles: DataFrame
              the median lifetimes for the individuals. If the survival curve of an
              individual does not cross 0.5, then the result is infinity.
  
  
          See Also
          --------
          predict_median