docstr: Test 0-indexed data.
docstr_tok: ["Test","0-indexed","data","."]
code: def test_index_order(self, data, eight_schools_params):
      """Test 0-indexed data."""
      # Skip test if pystan not installed
      pystan = importorskip("pystan")  # pylint: disable=import-error
  
      fit = data.model.sampling(data=eight_schools_params)
      if pystan.__version__ >= "2.18":
          # make 1-indexed to 0-indexed
          for holder in fit.sim["samples"]:
              new_chains = OrderedDict()
              for i, (key, values) in enumerate(holder.chains.items()):
                  if "[" in key:
                      name, *shape = key.replace("]", "").split("[")
                      shape = [
                          str(int(item) - 1)
                          for items in shape
                          for item in items.split(",")
                      ]
                      key = f"{name}[{','.join(shape)}]"
                  new_chains[key] = np.full_like(
                      values, fill_value=float(i)
                  )
              setattr(holder, "chains", new_chains)
          fit.sim["fnames_oi"] = list(
              fit.sim["samples"][0].chains.keys()
          )
      idata = from_pystan(posterior=fit)
      assert idata is not None
      for j, fpar in enumerate(fit.sim["fnames_oi"]):
          par, *shape = fpar.replace("]", "").split("[")
          if par in {"lp__", "log_lik"}:
              continue
          assert hasattr(idata.posterior, par), (
              par,
              list(idata.posterior.data_vars),
          )
          if shape:
              shape = [slice(None), slice(None)] + list(map(int, shape))
              assert idata.posterior[par][
                  tuple(shape)
              ].values.mean() == float(j)
          else:
              assert idata.posterior[par].values.mean() == float(j)
  
imports: import importlib
  from collections import OrderedDict
  import numpy
  import pytest
  from ...None import from_pystan
  from ...data.io_pystan import get_draws, get_draws_stan3
  from ..helpers import chains, check_multiple_attrs, draws, eight_schools_params, importorskip, load_cached_models, pystan_version, running_on_ci
label_desc: Use image node_id 12 for calling the TestDataPyStan obj's underlying member method code with example usage: obj.test_index_order(data, eight_schools_params) without return types