dictKeyGen¶
-
outputting.
dictKeyGen
(store, maxListLen=None, returnList=False, abridge=False)[source]¶ Identifies the columns necessary to convert a dictionary into a table
Parameters: - store (dict) – The dictionary to be broken down into keys
- maxListLen (int or float with no decimal places or None, optional) – The length of the longest expected list. Only useful if returnList is
True
. DefaultNone
- returnList (bool, optional) – Defines if the lists will be broken into 1D lists or values. Default
False
, lists will be broken into values - abridge (bool, optional) – Defines if the final dataset will be a summary or the whole lot. If it is a summary, lists of more than 10 elements are removed.
Default
False
, not abridged
Returns: - keySet (OrderedDict with values of OrderedDict, list or None) – The dictionary of keys to be extracted
- maxListLen (int or float with no decimal places or None, optional) – If returnList is
True
this should be the length of the longest list. If returnList isFalse
this should return its original value
Examples
>>> store = {'string': 'string'} >>> dictKeyGen(store) (OrderedDict([('string', None)]), 1) >>> store = {'num': 23.6} >>> dictKeyGen(store) (OrderedDict([('num', None)]), 1) >>> store = {'array': np.array([[1, 2, 3, 4, 5, 6], [7, 8, 9, 10, 11, 12]])} >>> dictKeyGen(store, returnList=True, abridge=True) (OrderedDict([(u'array', array([[0], [1]]))]), 6L) >>> store = {'dict': {1: "a", 2: "b"}} >>> dictKeyGen(store, maxListLen=7, returnList=True, abridge=True) (OrderedDict([('dict', OrderedDict([(1, None), (2, None)]))]), 7)