Indexable Dictionary Recipe¶
-
class
sortedcollections.
IndexableDict
(*args, **kwargs)¶ Dictionary that supports numerical indexing.
Keys are numerically indexable using the
iloc
attribute. For example:>>> indexable_dict = IndexableDict.fromkeys('abcde') >>> indexable_dict.keys() ['b', 'd', 'e', 'c', 'a'] >>> indexable_dict.iloc[0] 'b' >>> indexable_dict.iloc[-2:] ['c', 'a']
The
iloc
attribute behaves as a sequence-view for the mapping.