:py:mod:`pygsti.tools.nameddict` ================================ .. py:module:: pygsti.tools.nameddict .. autoapi-nested-parse:: The NamedDict class Module Contents --------------- Classes ~~~~~~~ .. autoapisummary:: pygsti.tools.nameddict.NamedDict .. py:class:: NamedDict(keyname=None, keytype=None, valname=None, valtype=None, items=()) Bases: :py:obj:`dict`, :py:obj:`pygsti.baseobjs.nicelyserializable.NicelySerializable` A dictionary that also holds category names and types. This `dict`-derived class holds a catgory name applicable to its keys, and key and value type names indicating the types of its keys and values. The main purpose of this class is to utilize its :meth:`to_dataframe` method. Parameters ---------- keyname : str, optional A category name for the keys of this dict. For example, if the dict contained the keys `"dog"` and `"cat"`, this might be `"animals"`. This becomes a column header if this dict is converted to a data frame. keytype : {"float", "int", "category", None}, optional The key-type, in correspondence with different pandas series types. valname : str, optional A category name for the keys of this dict. This becomse a column header if this dict is converted to a data frame. valtype : {"float", "int", "category", None}, optional The value-type, in correspondence with different pandas series types. items : list or dict, optional Initial items, used in serialization. Initialize self. See help(type(self)) for accurate signature. .. py:attribute:: keyname :value: 'None' .. py:attribute:: valname :value: 'None' .. py:attribute:: keytype :value: 'None' .. py:attribute:: valtype :value: 'None' .. py:method:: create_nested(key_val_type_list, inner) :classmethod: Creates a nested NamedDict. Parameters ---------- key_val_type_list : list A list of (key, value, type) tuples, one per nesting layer. inner : various The value that will be set to the inner-most nested dictionary's value, supplying any additional layers of nesting (if `inner` is a `NamedDict`) or the value contained in all of the nested layers. .. py:method:: to_dataframe() Render this dict as a pandas data frame. Returns ------- pandas.DataFrame