class_docstr: Container for inference data storage using xarray.
  
  For a detailed introduction to ``InferenceData`` objects and their usage, see
  :ref:`xarray_for_arviz`. This page provides help and documentation
  on ``InferenceData`` methods and their low level implementation.
class_docstr_tok: ["Container","for","inference","data","storage","using","xarray",".","For","a","detailed","introduction","to","``","InferenceData","``","objects","and","their","usage",",","see",":","ref",":","`","xarray_for_arviz","`",".","This","page","provides","help","and","documentation","on","``","InferenceData","``","methods","and","their","low","level","implementation","."]
docstr: Perform an xarray unstacking on all groups.
  
  Unstack existing dimensions corresponding to MultiIndexes into multiple new dimensions.
  Loops groups to perform Dataset.unstack(key=value).
  The selection is performed on all relevant groups (like posterior, prior,
  sample stats) while non relevant groups like observed data are omitted.
  See :meth:`xarray:xarray.Dataset.unstack`
  
  Parameters
  ----------
  dim : Hashable or iterable of Hashable, optional
      Dimension(s) over which to unstack. By default unstacks all MultiIndexes.
  groups : str or list of str, optional
      Groups where the selection is to be applied. Can either be group names
      or metagroup names.
  filter_groups : {None, "like", "regex"}, optional
      If `None` (default), interpret groups as the real group or metagroup names.
      If "like", interpret groups as substrings of the real group or metagroup names.
      If "regex", interpret groups as regular expressions on the real group or
      metagroup names. A la `pandas.filter`.
  inplace : bool, optional
      If ``True``, modify the InferenceData object inplace,
      otherwise, return the modified copy.
  
  Returns
  -------
  InferenceData
      A new InferenceData object by default.
      When `inplace==True` perform selection in place and return `None`
  
  Examples
  --------
  Use ``unstack`` to unstack existing dimensions corresponding to MultiIndexes into
  multiple new dimensions. We first stack two dimensions ``c1`` and ``c99`` to ``z``:
  
  .. jupyter-execute::
  
      import arviz as az
      import numpy as np
      datadict = {
          "a": np.random.randn(100),
          "b": np.random.randn(1, 100, 10),
          "c": np.random.randn(1, 100, 3, 4),
      }
      coords = {
          "c1": np.arange(3),
          "c99": np.arange(4),
          "b1": np.arange(10),
      }
      dims = {"c": ["c1", "c99"], "b": ["b1"]}
      idata = az.from_dict(
          posterior=datadict, posterior_predictive=datadict, coords=coords, dims=dims
      )
      idata.stack(z=["c1", "c99"], inplace=True)
      idata
  
  In order to unstack the dimension ``z``, we use:
  
  .. jupyter-execute::
  
      idata.unstack(inplace=True)
      idata
  
  See Also
  --------
  xarray.Dataset.unstack :
      Unstack existing dimensions corresponding to MultiIndexes into multiple new dimensions.
  stack : Perform an xarray stacking on all groups of InferenceData object.
docstr_tok: ["Perform","an","xarray","unstacking","on","all","groups",".","Unstack","existing","dimensions","corresponding","to","MultiIndexes","into","multiple","new","dimensions",".","Loops","groups","to","perform","Dataset.unstack","(","key=value",")",".","The","selection","is","performed","on","all","relevant","groups","(","like","posterior",",","prior",",","sample","stats",")","while","non","relevant","groups","like","observed","data","are","omitted",".","See",":","meth",":","`","xarray",":","xarray.Dataset.unstack","`","Parameters","--","--","--","--","--","dim",":","Hashable","or","iterable","of","Hashable",",","optional","Dimension","(","s",")","over","which","to","unstack",".","By","default","unstacks","all","MultiIndexes",".","groups",":","str","or","list","of","str",",","optional","Groups","where","the","selection","is","to","be","applied",".","Can","either","be","group","names","or","metagroup","names",".","filter_groups",":","{","None",",","``","like","''",",","``","regex","''","}",",","optional","If","`","None","`","(","default",")",",","interpret","groups","as","the","real","group","or","metagroup","names",".","If","``","like","''",",","interpret","groups","as","substrings","of","the","real","group","or","metagroup","names",".","If","``","regex","''",",","interpret","groups","as","regular","expressions","on","the","real","group","or","metagroup","names",".","A","la","`","pandas.filter","`",".","inplace",":","bool",",","optional","If","``","True","``",",","modify","the","InferenceData","object","inplace",",","otherwise",",","return","the","modified","copy",".","Returns","--","--","--","-","InferenceData","A","new","InferenceData","object","by","default",".","When","`","inplace==True","`","perform","selection","in","place","and","return","`","None","`","Examples","--","--","--","--","Use","``","unstack","``","to","unstack","existing","dimensions","corresponding","to","MultiIndexes","into","multiple","new","dimensions",".","We","first","stack","two","dimensions","``","c1","``","and","``","c99","``","to","``","z","``",":","..","jupyter-execute",":",":","import","arviz","as","az","import","numpy","as","np","datadict","=","{","``","a","''",":","np.random.randn","(","100",")",",","``","b","''",":","np.random.randn","(","1",",","100",",","10",")",",","``","c","''",":","np.random.randn","(","1",",","100",",","3",",","4",")",",","}","coords","=","{","``","c1","''",":","np.arange","(","3",")",",","``","c99","''",":","np.arange","(","4",")",",","``","b1","''",":","np.arange","(","10",")",",","}","dims","=","{","``","c","''",":","[","``","c1","''",",","``","c99","''","]",",","``","b","''",":","[","``","b1","''","]","}","idata","=","az.from_dict","(","posterior=datadict",",","posterior_predictive=datadict",",","coords=coords",",","dims=dims",")","idata.stack","(","z=","[","``","c1","''",",","``","c99","''","]",",","inplace=True",")","idata","In","order","to","unstack","the","dimension","``","z","``",",","we","use",":","..","jupyter-execute",":",":","idata.unstack","(","inplace=True",")","idata","See","Also","--","--","--","--","xarray.Dataset.unstack",":","Unstack","existing","dimensions","corresponding","to","MultiIndexes","into","multiple","new","dimensions",".","stack",":","Perform","an","xarray","stacking","on","all","groups","of","InferenceData","object","."]
code: def unstack(
      self, dim=None, groups=None, filter_groups=None, inplace=False
  ):
      """Perform an xarray unstacking on all groups.
  
      Unstack existing dimensions corresponding to MultiIndexes into multiple new dimensions.
      Loops groups to perform Dataset.unstack(key=value).
      The selection is performed on all relevant groups (like posterior, prior,
      sample stats) while non relevant groups like observed data are omitted.
      See :meth:`xarray:xarray.Dataset.unstack`
  
      Parameters
      ----------
      dim : Hashable or iterable of Hashable, optional
          Dimension(s) over which to unstack. By default unstacks all MultiIndexes.
      groups : str or list of str, optional
          Groups where the selection is to be applied. Can either be group names
          or metagroup names.
      filter_groups : {None, "like", "regex"}, optional
          If `None` (default), interpret groups as the real group or metagroup names.
          If "like", interpret groups as substrings of the real group or metagroup names.
          If "regex", interpret groups as regular expressions on the real group or
          metagroup names. A la `pandas.filter`.
      inplace : bool, optional
          If ``True``, modify the InferenceData object inplace,
          otherwise, return the modified copy.
  
      Returns
      -------
      InferenceData
          A new InferenceData object by default.
          When `inplace==True` perform selection in place and return `None`
  
      Examples
      --------
      Use ``unstack`` to unstack existing dimensions corresponding to MultiIndexes into
      multiple new dimensions. We first stack two dimensions ``c1`` and ``c99`` to ``z``:
  
      .. jupyter-execute::
  
          import arviz as az
          import numpy as np
          datadict = {
              "a": np.random.randn(100),
              "b": np.random.randn(1, 100, 10),
              "c": np.random.randn(1, 100, 3, 4),
          }
          coords = {
              "c1": np.arange(3),
              "c99": np.arange(4),
              "b1": np.arange(10),
          }
          dims = {"c": ["c1", "c99"], "b": ["b1"]}
          idata = az.from_dict(
              posterior=datadict, posterior_predictive=datadict, coords=coords, dims=dims
          )
          idata.stack(z=["c1", "c99"], inplace=True)
          idata
  
      In order to unstack the dimension ``z``, we use:
  
      .. jupyter-execute::
  
          idata.unstack(inplace=True)
          idata
  
      See Also
      --------
      xarray.Dataset.unstack :
          Unstack existing dimensions corresponding to MultiIndexes into multiple new dimensions.
      stack : Perform an xarray stacking on all groups of InferenceData object.
      """
      groups = self._group_names(groups, filter_groups)
      if isinstance(dim, str):
          dim = [dim]
  
      out = self if inplace else deepcopy(self)
      for group in groups:
          dataset = getattr(self, group)
          valid_dims = (
              set(dim).intersection(dataset.dims)
              if dim is not None
              else dim
          )
          dataset = dataset.unstack(dim=valid_dims)
          setattr(out, group, dataset)
      if inplace:
          return None
      else:
          return out
  
imports: import os
  import re
  import sys
  import uuid
  import warnings
  from collections import OrderedDict, defaultdict
  from collections.abc import MutableMapping, Sequence
  from copy import copy
  from copy import deepcopy
  from datetime import datetime
  from html import escape
  from typing import TYPE_CHECKING, Any, Iterable, Iterator, List, Mapping, Optional, Tuple, TypeVar, Union, overload
  import numpy
  import xarray
  from packaging import version
  from ..rcparams import rcParams
  from ..utils import HtmlTemplate, _subset_list, _var_names, either_dict_or_kwargs
  from .base import _extend_xr_method, _make_json_serializable, dict_to_dataset
label_desc: Use image node_id 29 for calling the InferenceData obj's underlying member method code with example usage: obj.unstack(dim, groups, filter_groups, inplace) and returns: None, out