How to specify coordinate names in summary()

I have an InferenceData object and I want to call arviz.summary(idata). The index of the resulting summary dataframe is Index(['alpha', 'c[0]', 'c[1]', ..., 'delta[9]', ]). Instead of these numbered coordinates, how do I get arviz.summary() to use the more human-friendly coordinate names that are listed in idata.posterior.coords["c_dim_0"] and idata.posterior.coords["delta_dim_0"]?

1 Like

It is not currently possible, but at some point it will be. You should follow https://github.com/arviz-devs/arviz/issues/1091 to be notified when this feature is added.

1 Like

I use my own function

def get_stats(cmdstan_data):
    # include mean and hpd
    stats = az.summary(cmdstan_data,credible_interval=0.95).reset_index().rename(columns={'index':'var'})
    stats['time'] = stats['var'].apply(lambda st: st[st.find("[")+1:st.find("]")])
    stats['time'] = ['NA' if "[" not in y else int(x)+1 for x,y in zip(stats['time'],stats['var'])]
    stats['var'] = stats['var'].apply(lambda st: st[:st.find("[")] if "[" in st else st)
    return stats

it can generalized to 2d if necessary. Maybe it would be helpful for you too