key

Comparing the keys of one dictionary with the values of another

Comparing the keys of one dictionary with the values of another Question: So, I have two dictionaries. Both are created from a txt-file with different Documents. The first dictionary has as its keys the Document-Id and as the corresponding value the document itself. The second dictionary has as keys every word of all the documents …

Total answers: 1

Using a list to find occurrences in a nested dictionary

Using a list to find occurrences in a nested dictionary Question: So I have a nested dictionary: {1: {‘letter’: ‘A’, ‘is_vowel’: True, ‘point_value’: 1}, 2: {‘letter’: ‘B’, ‘is_vowel’: False, ‘point_value’: 3}, 3: {‘letter’: ‘C’, ‘is_vowel’: False, ‘point_value’: 3}, 4: {‘letter’: ‘D’, ‘is_vowel’: False, ‘point_value’: 2}, 5: {‘letter’: ‘E’, ‘is_vowel’: True, ‘point_value’: 1}, 6: {‘letter’: ‘F’, …

Total answers: 5

How to find if in created dictionary the chosen sequence has two aa letters?

How to find if in created dictionary the chosen sequence has two aa letters? Question: Lets say I have a dictionary. Is it possible to use the input function to enter the key and get the True for its specific value: dictionaryOne = { "ABCD" : "aatttgggtcatcg", "SSEE" : "atgcccgta", "GTAD" : "atgccggaaa" } I …

Total answers: 2

how to get modulus difference of values of two json objects in python

how to get modulus difference of values of two json objects in python Question: I have two JSON arrays , I need to get the modulus difference of the JSON object keys. My array list can have 1000s of elements. How to calculate it efficiently? Is there a way to do it parallelly without using …

Total answers: 1

Python Taking API response and adding to JSON Key error

Python Taking API response and adding to JSON Key error Question: I have a script that takes an ID from a JSON file, adds it to a URL for an API request. The aim is to have a loop run through the 1000-ish ids and preduce one JSON file with all the information contained within. …

Total answers: 1

How to order list of dictionaries in python by a given value in sub-list of dictionaries?

How to order list of dictionaries in python by a given value in sub-list of dictionaries? Question: I am having a list of dictionaries containing sub-list of dictionaries: x = [{‘id’: ‘1’, ’employe_id’: 15, ‘name’: ‘John’, ‘columns’: [{‘Age’: ’22’, ‘class’: ‘int’}, {‘Salary’: ‘2700’, ‘class’: ‘int’}]}, {‘id’: ‘2’, ’employe_id’: 11, ‘name’: ‘Sara’, ‘columns’: [{‘Age’: ’19’, ‘class’: …

Total answers: 1

how to compare two dictionaries with different keys but similar values and delete the duplicates

how to compare two dictionaries with different keys but similar values and delete the duplicates Question: I am quite new to python and I am keen on learning. I have two dictionaries that have different keys but similar values in it, as follows: dict_a = {‘r1’: [‘c5’, ‘c6’, ‘c7’, ‘c8’], ‘r2’: [‘c9’, ‘c10’, ‘c11’], ‘r3’: …

Total answers: 2

How to make a one key for all values in dictonary python

How to make a one key for all values in dictonary python Question: I have a list: List_ = ["Peter", "Peter", "Susan"] I want to make a dictonary like this: Dict_ = {"Name": "Peter", "Count": 2, "Name": "Susan", "Count": 1} Dict_ = {} Dict_new = {} for text in List_: if text not in Dict_: …

Total answers: 3

How do I get specific keys and their values from nested dict in python?

How do I get specific keys and their values from nested dict in python? Question: I need help, please be kind I’m a beginner. I have a nested dict like this: dict_ = { "timestamp": "2022-11-18T10: 10: 49.301Z", "name" : "example", "person":{ "birthyear": "2002" "birthname": "Examply" }, "order":{ "orderId": "1234" "ordername": "onetwothreefour" } } How …

Total answers: 2

How to print only one list element where list is value in key:value pair

How to print only one list element where list is value in key:value pair Question: I’m really new to the world of python, and especially dictionaries, so it is very likely that the answer to my question is quite simple, but I really can’t figure it out… My problem is, that I can’t seem to …

Total answers: 3