Linked Questions

0 votes
1 answer
139 views

I need to update the value in a nested dictionary, however I have a list with all of the keys that I need to go through in order to get tot hat value. However this list is automatically generated and ...
zendek's user avatar
  • 34
0 votes
0 answers
188 views

I have a number of dot notation strings and their values that I want to use to create a dictionary of dictionaries, but I'm stuck... For example, I have these strings: tagPaths = [] tagPaths.append(&...
njminchin's user avatar
  • 462
0 votes
0 answers
47 views

How can I achieve the same thing in Python 2? I don't believe dotty_dict works in python 2.7 whereas it will in python 3. from dotty_dict import dotty dot = dotty() alist = ['a.b.c.d.e.f.g.h.i', 'a....
tsai9_9's user avatar
222 votes
22 answers
197k views

I have a complex dictionary structure which I would like to access via a list of keys to address the correct item. dataDict = { "a":{ "r": 1, "s": 2, ...
kolergy's user avatar
  • 2,446
165 votes
21 answers
169k views

Is there are more readable way to check if a key buried in a dict exists without checking each level independently? Lets say I need to get this value in a object buried (example taken from Wikidata): ...
loomi's user avatar
  • 3,136
12 votes
3 answers
7k views

I feel like I saw a way to do this recently. Say I've got an empty dict and I want to set a value in a nested dict inside that empty dict, but obviously that nested dict hasn't been created yet. Is ...
skandocious's user avatar
-3 votes
2 answers
2k views

I have a string 'request.context.user_id' and I want to split the string by '.' and use each element in the list as a dictionary key. Is there a way to do this for lists of varying lengths without ...
MrStutterZ's user avatar
0 votes
2 answers
122 views

I have a dictionary as follows: mydict = {'HEALTH': {'NumberOfTimes': 2, 'Score': 12}, 'branch': {'NumberOfTimes': 4, 'Score': 34}, 'transfer': {'NumberOfTimes': 1, 'Score': 5}, 'deal': {'...
Kristada673's user avatar
  • 3,764
0 votes
0 answers
191 views

I have list of elements like a=[0,1,2,3], I want to convert these list elements into multidimensional dictionary a[0][1][2][3] is it possible using python. i.e input a=[0,1,2,3] and desired output a[...
user199354's user avatar
0 votes
1 answer
129 views

So I have a nested dictionary in Python: {'entry': {'definition': 'str', 'endTime': 'str', 'entryID': {'identifierType': 'str', 'identifierValue': 'str'}, 'instrument': {'FIB': {'...
mathwiz97's user avatar
-1 votes
1 answer
88 views

I'm trying to create a nested dictionary in Python so that, given a list of strings, the dictionary records the number of occurrences of that string order. For example, if the string list is: ["...
Pablo's user avatar
  • 95
0 votes
0 answers
46 views

Dfs is a dict with dataframes and the keys are named like this: 'datav1_135_gl_b17' We would like to calculate a matrix with constants. It should be possible to assign the values in the matrix ...
Marvin Langer's user avatar