pygsti.tools.nameddict
The NamedDict class
Module Contents
Classes
A dictionary that also holds category names and types. |
- class pygsti.tools.nameddict.NamedDict(keyname=None, keytype=None, valname=None, valtype=None, items=())
Bases:
dict
,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
to_dataframe()
method.Parameters
- keynamestr, 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.
- valnamestr, 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.
- itemslist or dict, optional
Initial items, used in serialization.
Initialize self. See help(type(self)) for accurate signature.
- keyname
- valname
- keytype
- valtype
- classmethod create_nested(key_val_type_list, inner)
Creates a nested NamedDict.
Parameters
- key_val_type_listlist
A list of (key, value, type) tuples, one per nesting layer.
- innervarious
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.