code: def posterior_predictive_to_xarray(self):
          
          posterior_predictive = self.posterior_predictive
          columns = self.posterior[0].columns
          if (
              isinstance(posterior_predictive, (tuple, list))
              and posterior_predictive[0].endswith(".csv")
          ) or (isinstance(posterior_predictive, str) and posterior_predictive.endswith(".csv")):
              if isinstance(posterior_predictive, str):
                  posterior_predictive = [posterior_predictive]
              chain_data = []
              for path in posterior_predictive:
                  parsed_output = _read_output(path)
                  for sample, *_ in parsed_output:
                      chain_data.append(sample)
              data = _unpack_dataframes(chain_data)
          else:
              if isinstance(posterior_predictive, str):
                  posterior_predictive = [posterior_predictive]
              posterior_predictive_cols = [
                  col
                  for col in columns
                  if any(item == col.split(".")[0] for item in posterior_predictive)
              ]
              data = _unpack_dataframes([item[posterior_predictive_cols] for item in self.posterior])
          return dict_to_dataset(data, coords=self.coords, dims=self.dims)
docs: Convert posterior_predictive samples to xarray.