dictionary

How to import data form lists in a dictionary in Python?

How to import data form lists in a dictionary in Python? Question: I want to create a program that takes 3 different inputs and stores them in 3 separate lists and then be able to combine them in a dictionary and print on screen. So far I got this : size = input("Enter size of …

Total answers: 1

How do I access using Python Dict and List

How do I access using Python Dict and List Question: Here I am giving two variables namely "a", "result". If "result" matches with any of the record in "a" in "city" then it should return entire record of the "a" variable. a = { "output": [ {"name": "India", "state": [ { "city": ["c", "d" ] …

Total answers: 2

Transform a dictionary into a list of tuples with Python

Transform a dictionary into a list of tuples with Python Question: I want to transform a dictionary into a list of tuples, but doing it ‘row-wise’: the first tuple should cointain the first values, the second tuple the second values, and so on. I have some working code, but I wonder if there is a …

Total answers: 2

How to use a dictionary to standardize terminology across lists

How to use a dictionary to standardize terminology across lists Question: I have been trying to solve this issue for a while but I can’t seem to think of a right solution. Basically, I am parsing few pdfs and depending on the source of the pdf, the terminology used is different. For example, source A1 …

Total answers: 1

Python Find matching item in a list of dictionaries

Python Find matching item in a list of dictionaries Question: I have a big list of dictionaries. Each dictionary contains timeseries data of each sensor when each data point is collected. I want to know the index location of a specific sensor and date. So, I can update the sensor value. My code: big_list = …

Total answers: 7

How to get a list of dictionary in a single column of pandas dataframe

How to get a list of dictionary in a single column of pandas dataframe Question: Hi I have a dataframe in 1NF form which I wanted to change to different format where I can access those values. This is how my dataframe looks like Code ProvType Alias spec_code 1A12 A Hi 1 1A12 B Hi …

Total answers: 2

Hill climbing algorithm with steps proportional to derivative?

Hill climbing algorithm with steps proportional to derivative? Question: I am writing a hill climbing algorithm where I want the step size to be proportional to the local derivative/gradient at a specific point. However, the algorithm seems to get stuck in a trough that I can’t really understand, for example given a starting point at …

Total answers: 1