All Questions
Tagged with python dictionary
47,782
questions
0
votes
0
answers
5
views
changing Data type input from MySQL in FastAPI
I have "serialize_response" error for this line :
@app.get("/get-sensors/", response_model=List[Data])
and this :
return {"status": "success", "list":...
-1
votes
1
answer
24
views
TypeError: 'NoneType' object is not subscriptable while fetching information for rejected reason from jira [duplicate]
for issue in issues:
fields = issue['fields']
results.append({
'key': issue['key'],
'summary': fields['summary'],
'description': fields['description'],
'...
1
vote
2
answers
39
views
Python nested dictionary to Tree
I am trying to display my nested dictionary as a Tree.
data = {"L1" :
{"sub L1" :
"sub sub L1"},
"L2" :
"...
-1
votes
0
answers
28
views
Non destructive dictionary update in python [duplicate]
Is there a library function that implements a non-destructive dictionary update like
def update(d,key,val) :
d=d.copy()
d[key]=val
return d
0
votes
0
answers
31
views
Issue with tkinter (pyimage10) [closed]
This call back error. Im trying to call a menu from a separate script using a fuction. It seems like garbage collector is messing with the menu images.
Ive tried moving my images into a dictionary and ...
-1
votes
2
answers
44
views
Take a Python dictionary with values as lists and create a new list of dictionaries each with the initial key and list values
If I have a dictionary with list values:
users = {'first-name': ['Jim', 'John', 'Jane'], 'last-name': ['Boothe', 'Smith', 'Doe'], 'user': ['100', '101', '102']}
How can I create a new list of ...
-7
votes
0
answers
48
views
Adding items in python dictionary [closed]
student_scores = {
"Harry": 81,
"Ron": 78,
"Hermione": 99,
"Draco": 74,
"Neville": 62,
}
student_grades = {}
for student in ...
-8
votes
0
answers
46
views
Python. How to parse indented text to dicts?
I have this text from the log. How to convert it to a dictionary? The ultimate goal is that ITEMs that contain a date do not need to be converted (item[3,4]).
CodAnsw = 12
IdentAnsw = 1
Data:
...
1
vote
2
answers
55
views
Pandas Map Dictionary with Multiple Values to Dataframe
I have the following dataframe:
data = [['BALANCED', 'Corp EUR'], ['YIELD', 'Corp USD'], ['GROWTH', 'HG CHF']]
df = pd.DataFrame(data, columns=['STRATEGY', 'ASSET_CLASS']
df
STRATEGY ...
2
votes
3
answers
59
views
Appending multiple dictionaries to specific key of a nested dictionary
I want to append different dictionaries having the key as the meal_name and having total_calories and total_protein as a tuple being the value of the dictionary without overwriting the original ...
-5
votes
2
answers
58
views
Compare python dictionaries and find missing elements
I'm encountering a problem, I've been trying for days but without getting any results. I would like to compare 2 dictionaries, in one dictionary there are "Pre match" football matches and in ...
-4
votes
1
answer
66
views
Why do I get "NoneType object is not iterable" when filtering a list of dictionaries with list comprehension and handling None? [closed]
I'm trying to filter a list of dictionaries in Python using list comprehension. I am handling None values, but I keep getting the error "NoneType object is not iterable". I expected my code ...
-5
votes
1
answer
57
views
Dictionary Update Stops at Index 35
I'm trying to iterate through a list (config_patterns) and add each element as a key to a dictionary (predefined_patterns) with a value of 0. There are 40 elements in this list. However, the final ...
2
votes
2
answers
57
views
Dictionary indexing with Numpy/Jax
I'm writing an interpolation routine and have a dictionary which stores the function values at the fitting points. Ideally, the dictionary keys would be 2D Numpy arrays of the fitting point ...
-4
votes
1
answer
54
views
How to convert a tuple which includes a [string] to a dictionary item
I have this list:
address_table3 = [(1, ['21 South Main']), (2, ['1560 West St']), (3, ['1900 Broadway'])]
I want to convert it to a dictionary with the address as key and integer as value.
When I ...