(frame)
return ret
dictify_df converts a frame with columns

      col1    | col2    | .... | coln   | value
      ...
    to a dictionary that maps values valX from colX

    { val1 -> { val2 -> { ... { valn -> value } } } }
dictify_df converts a frame with columns
dictify_df converts a frame with columns
def dictify_df(frame):
    """
    dictify_df converts a frame with columns

      col1    | col2    | .... | coln   | value
      ...
    to a dictionary that maps values valX from colX

    { val1 -> { val2 -> { ... { valn -> value } } } }
    """
    ret = {}
    for row in frame.values:
        cur_level = ret
        for elem in row[:-2]:
            if elem not in cur_level:
                cur_level[elem] = {}
            cur_level = cur_level[elem]
        cur_level[row[-2]] = row[-1]
    return ret
def dictify_df ( frame ) : ret = { } for row in frame . values : cur_level = ret for elem in row [ : - 2 ] : if elem not in cur_level : cur_level [ elem ] = { } cur_level = cur_level [ elem ] cur_level [ row [ - 2 ] ] = row [ - 1 ] return ret