Category "dictionary"

SWI-Prolog: Looking for a way to print dictionary values in seperate lines

I am searching a way to print some dictionary values in a way every value is on a separate line in the terminal. For example if I have X = abc{a:1,b:2,c:3,d:4,e

How to create a dictionary, where the key is the key of a dictionary of lists and the value is the longest list

I have this dictionary of lists of dictionaries: dict_countries ={'uk': [{'datetime': '1955-10-10 17:00:00', 'city': 'chester'},{'datetime': '1956-09-10 13:00:0

Iterate through a nested python dict

I have a JSON file that looks like this: { "returnCode": 200, "message": "OK", “people”: [ { “details: {

Create jinja template from dictionary in ansible

how can I access stdout and item values in a dictionary? My inventory file: all: hosts: server1: dict: custom_mountpoints: - /srv/

Need help on Array VBA

I don't understand some parts in the following code: For i = 2 To UBound(a, 1) txt = Join$(Array(a(i, 3), a(i, 4)), Chr(2)) If Not dic.exist

Fastest and most efficient way to save and load a large dict

I have a problem. I have a huge dict. I want to save and load this huge dict. But unfortunately I got an MemoryError. The dict should not be too big. What is r

function that takes directory of .txt file and returns a dictionary based on set parameters?

I want to make a function that takes the directory of a .txt file as an input and returns a dictionary based on specific parameters. If the .txt file is empty,

Java time-based map/cache with expiring keys [closed]

Do any of you know of a Java Map or similar standard data store that automatically purges entries after a given timeout? This means aging, whe

Create Dictionary of Specific Keys and Values from a Lst of Dictionaries

I have a list of dictionaries which looks like this: dic = [ {'id': 'Team1', 'name': 'Team One', 'description': 'This is team 1', 'type': 'team'}, {'id': 'Tea

C# Deserialize dictionary with complex properties names to JSON string

I have the following dictionary, each dictionary key potentially needs to be split by '.' and represented as json object/property/array etc. var data = new Dict

How to estimate similarity between sensor data based on the number of occurrence?

Following is my sample data: data = {850.0: 6, -852.0: 5, 992.0: 29, -993.0: 25, 990.0: 27, -992.0: 28, 965.0: 127, 988.0: 37, -994.0: 24, 996.0: 14, -996.0: 1

How to map single column in pandas using multiple columns (text and numbers) in a separate df

I'm trying to convert U.S. geolocation codes for states, counties and cities. The problem is, the county and city codes are duplicated -- meaning, multiple stat

how to parse yaml file that contains dictionary and structure at multiple levels in C++

I am trying to parse a yaml file that likes like below in C++: test_case_0: - input: a: 10 b: 5 - output: area: 50 delta: 5 test_case_1: - input

Type hint for an exhaustive dictionary with Enum/Literal keys

I'm working on code bases with extensive type hints, checked by mypy. There's several instances where we have a mapping from an enum.Enum or other small finite

How can you iterate through a tuple (str), then return a dictionary containing the keys (from the tuple) and the index of the keys as the values?

How can you iterate through a tuple (str), then return a dictionary containing the keys (from the tuple) and the index of the keys as the values? Input: tup = (

how to create a dataframe from a list of dictionary value?

I have a list - elements_listed = [{'data': {'data/2022/04/1': '26-Apr-2022 07:47', 'data/2022/04/2': '24-Apr-2022 17:27', 'data/2022/04/3': '22-Apr-2022 14:20'

Inserting multiple values into a string

I am trying to run this command but need to insert new two variables for every time I run this command. I think the right approach is to loop through a dictiona

Re-ordering columns in a csv but with Dictionaries

I need to re-order columns in a csv but I'll need to call each column from a dictionary. EXAMPLE: Sample input csv File: $ cat file.csv A,B,C,D,E a1,b1,c1,d1,e1

Changing key name of a dictionary by comparing while keeping key value python

I have a dict with two strings "Candy-one" and "Candy-two" as the key and Capacity as the key pair. I wish to replace the strings "Candy-one" and "Candy-two" wi

Bytes object has not attribute json with requests

I am extracting BTC history data from a website and want to store these results. I want to run this in a function and then use map because it's much faster than