Newest 'dictionary' Questions - Stack Overflow

Questions tagged [dictionary]

A dictionary (or map) in computer science is a data structure that maps keys to values such that given a key its corresponding value can be efficiently retrieved. For questions about Mapping Functions over collections of data, Please Use [map-function] tag; and for geography, [maps].

0
votes
0answers
4 views

Do you need to retreive a key for a password hashed in MD5 - Is it possible to decrypted a password in MD5 when it's not already stored ona database?

I need to "unsalt" some salted hash. It's in MD5, I can't run any attacks because they've include spaces and words that cannot be found in a diuctionary as well as abbreviations that I will not be ...
0
votes
0answers
10 views

Dumping keypoint and frames , of an entire video sequence to json file?

I am working on extracting keypoints using 2d pose estimation I have managed to convert 1x17x2 array into a 1D vector of 1x34 . I am trying to dump keypoints and frame information to do some post ...
0
votes
0answers
13 views

Conv json obj w/ varying keys & key:value pairs to python list for specific keys:values

I have received a json file from an api and want to convert it from to a dictionary to a list in python. I already have it loaded as a python dictionary, so I'm really just looking to iterate over it ...
0
votes
2answers
14 views

Flutter Comparing 2 lists of objects using map and contains not working

I have 2 lists of Objects namely newList and oldList as shown below: newList: [Object{id: -LhnrmWPWN2X_cWdIAQW, title: , category: abandoned, latitude: -17.8594103, longitude: 30.9615846}, Object{id: ...
-2
votes
2answers
21 views

Checking for dictionary key based on dictionary values in a sentence

I have a dictionary where values correspond to words and their keys correspond to categories for those words. I want to check whether these words/values exist in a sentence, if yes return category/key ...
-2
votes
1answer
37 views

Update a list in a nested dictionary

I have a nested dicts. Here is my dict: org_query = {"query": {"bool": {"must": [],"must_not": []}}} I want to update another dict inside the nested dict. Here's the dict i want to add: query_form =...
0
votes
2answers
31 views

Swift - Reading different types of values from a dictionary

Presently the code that I have is reading all the values as String. However at times when an integer or decimal values are present, it gets read as nil. Present code: let fieldName = String(arr[0]) ...
0
votes
0answers
47 views

Can't append new variables to my python dictionary

I am making a language in python called PythonScript, which is a JavaScript and Python (not Python 3) mix. I am adding variables, but when I do the following code I don't get the expected result. ...
0
votes
1answer
22 views

How can I flip my axis to the top and right (Instead of bottom and left)

I need to flip the numbers (and tick marks) of the y-axis and x-axis to the right and top respectively (instead of where they are now). My code: baseInset = get_map(location=c(-160.8,18.5,-154.625,...
0
votes
1answer
25 views

Get largest key from dictionary in Python [duplicate]

How can I get the largest key in a dictionary which may have mixed data types? For example: myDict = {1: 'foo', 2: 'bar', 3: None, 4: 1000} I want to get the largest key which is 4. I tried max(...
0
votes
1answer
10 views

How to extract specific data from JSON output based on today's date in python

I'm accessing an API that allows me to pull employee time punches in and out during a given pay period. This JSON output is massive with a lot of data I don't need. All I really need from it is the ...
0
votes
0answers
24 views

How to implement the following desired Hashmap

I want to create 2 level deep nested hashmap to represent the types of books stored at each library and a method that updates the data structure when needed.The first level keys are distinct library ...
-1
votes
4answers
35 views

How to put functions into a dictionary so that they can be iterated over? [duplicate]

I'm trying to make a dictionary which contains functions as the values. The idea is that the difficulty variable will change throughout the program, and this will affect which function we call from ...
-1
votes
1answer
19 views

Convert dictionary of dictionary into jsonObject to send as RequestBody swift

I am trying to convert a Dictionary that has an array of dictionary inside it to Json Object which as a JsonArray of JsonObject inside it to send a request but I always get an error stating: "*** ...
-1
votes
2answers
51 views

SwiftUI iterating through dictionary with ForEach

Is there a way to iterate through a Dictionary in a ForEach loop? Xcode says Generic struct 'ForEach' requires that '[String : Int]' conform to 'RandomAccessCollection' so is there a way to make ...
0
votes
0answers
41 views

Java 8 return from Optional Map

I have a code segment as follows: class MyObject{ Set<AnotherObject> mySet; public Set<MyAnotherObject> getMySet(){ // getter code } } if ( myObject.getMySet().isEmpty() ) { ...
2
votes
2answers
22 views

SAS Lookup on Per Variable Basis

I have two tables in SAS, Table A and Table B. Suppose I want to write a little SAS code to obtain the table "Desired Output." How would I do this? Table A: Observation Var1 Var2 1 0 ...
1
vote
5answers
55 views

put the whole list in one dataframe column

I'm trying to create a dataframe from a dictionary: dict = {'foo': [1, 2, 3, 4], 'bar': [5, 6, 7, 8]} and I use the below command to create the dataframe: df = pd.DataFrame.from_dict(dict, ...
1
vote
1answer
28 views

Passing selected arguments from a dictionary to a function

Given a set of functions that differ in their signatures and a dictionary that contains (key, value) pairs for each of the required arguments, I want to find an elegant way of passing the dictionary ...
-1
votes
0answers
35 views

Get method for nested dictionary

How can I use the get() of a dictionary to get the value "paul" in a variable like v = d.get(0)? d = { 0 : {"prenom": "paul", "age" : 23} , 1 : {"prenom": "...
0
votes
1answer
41 views

Java TreeMap.floorKey() equivalent in CPP STL map class

Java Program: TreeMap<Integer,Integer> map = new TreeMap<Integer,Integer>(); map.put(10, 100); map.put(20, 200); map.put(30, 300); map.put(40, 400); map.put(50, 500); map.put(60, 600); ...
0
votes
3answers
21 views

Keep Elements of a dictionary rather than pop?

l = {'apple': [0, 4], 'orange': [3], 'beer': [9], 'rice': [6], 'melon': [10, 11]} How do I retain only {apple: [0,4], melon:[10,11]} I know the lengths of these are 2.
0
votes
0answers
6 views

Create measure dictionary for area annotation in iText

The supposed value for this would is 15.2 sq cm. however, when annotation is moved, it becomes 0.04 sq cm. I got this data from my application where area is computed as 9658.6572265625 and its ...
0
votes
1answer
50 views

How to filter array of dictionary data on based on user input in textfield

Hi I using the array model data, I load that data into tableview. But I want to search that data based on user input in textField. Code. func tableView(_ tableView: UITableView, cellForRowAt ...
0
votes
0answers
31 views

MongoDB: dictionary.get() convert as new dictionary

I extracted documents from a MongoDB Collection. (The documents are highly nested.) I wanted to get a "sub-tree" with all it's nested elements. But the new sub-tree has type 'list'. How can I convert ...
0
votes
1answer
25 views

How to modify an existing dictionary in ansible?

I'm trying to add an existing list to an existing dict in Ansible. I have a dict "jbossvars" containing the following (ansible debug) "jbossvars": { "environments": { "TEST_ENV": { ...
0
votes
0answers
21 views

Read data from swift struct class in objective C

I have issue in reading Swift struct class in objective C. My swift struct class contains code to make dictionary case insensitive. In swift, it is working but in objective c, when I read value of ...
1
vote
1answer
43 views

How to use map[string]*string

I'm trying to use sarama (Admin mode) to create a topic. Without the ConfigEntries works fine. But I need to define some configs. I set up the topic config (Here is happening the error): ...
-1
votes
2answers
20 views

how do I get the index from this function

this is demo of iOS Charts library (LineChart) and I want to input my data instead of arc4random data. My data is in Array so I have to approach with index but I can't understand the (0..<count)....
1
vote
2answers
41 views

Count occurrence of strings in list of lists

I want to count the number of times a string has occurred in a list which is in another list and store it in a list of dictionary where each dictionary has count of a list. Ex, list = [['Sam','John','...
-1
votes
1answer
34 views

Python - Garbage collection very slow, can't disable gc

I am developing a program that uses pandas dataframes and large dictionaries. The dataframe is read from a CSV that is approx. 700MB. I am using Python 3.7.3 on Windows I noticed that the program I ...
0
votes
0answers
10 views

How to inject values to apache commons collection MultiValuedMap from xml file?

I have a requirement to use multiKeys in Map. But, from the standard Java it is not possible. Later, I found that MultiValuedMap from apache commons collection will fulfill my requirement. If it is ...
0
votes
1answer
54 views

C++ map set hybrid

I have folder information in struct folder { int id; int folder_count; long long size; }; I need to keep folders (can be 1000 or more ) sorted by their folder_count and size respectively ...
0
votes
2answers
53 views

Getting 100 longest movie titles in Python

I am reading data from a tsv file, which has movie titles. I have stored all the titles and their lengths as a key value pair in my Counter object counter: with open(sys.argv[1], encoding="utf-8") as ...
0
votes
0answers
6 views

How to simultaneously take data from the database and use the map

We need the program to take data (latitude and longitude) from our database and add markers with these coordinates to the map MapsActivity: package ilfarsif.myapp_places; import android....
0
votes
0answers
20 views

Troubles with tilemap's size in Unity 2D

I want to make a tilemap in unity and I'm having some troubles. I need to draw the background, but when I do it, the tilemap's size increases and I don't know why. I want to make it adaptable to the ...
1
vote
1answer
37 views

How to read a dictionary tree

Let us assume to have the following tree structure: a = [(1, 2), (2, 2), (3, 2), (4, 2), (5, 4), (6, 5), (7, 8), (8, 11), (9, 10), (10, 11), (11, 11)] so we get with this code Python - Generate a ...
0
votes
1answer
33 views

Aggregate dictionary values with different function

I have a dictionary which basically it's look like this: dict = {'A': [1,5,6,7], 'B':[1,8,8]} I want to grp by keys and aggregate values with different function. i.e mean or standard ...
0
votes
1answer
34 views

Confusing error message from an incorrect use of dict()

I have just come across the construct for d3, where the first parameter is a map, and the rest are unpacked key, values. >>> d1 = dict(a=1, b=2, c=3) >>> d2 = dict(d=4, e=5) >>...
1
vote
1answer
46 views

How to solve fatal error: concurrent map read and map write

I'm writing some program in Go, I get this crash: fatal error: concurrent map read and map write consensus/bft.(*ConsensusManager).getHeightManager(0xc42009a7e0, 0x37, 0x0) consensus/bft/...
0
votes
0answers
9 views

Reverse.geocoder API with Here map

Please find below the response when heremap api is called: Request https://reverse.geocoder.api.here.com/6.2/reversegeocode.json?prox=13.0275901,80.27571739999999&mode=retrieveAddresses&...
0
votes
0answers
16 views

Plotting Grid Search CV grid parameter results on one graph

In sklearn 0.17.1 there was-->> grid_scores_ : list of named tuples (https://scikit-learn.org/0.17/modules/generated/sklearn.grid_search.GridSearchCV.html#sklearn.grid_search.GridSearchCV) Now in ...
0
votes
2answers
40 views

How to generically serialize and de-serialize objects from dictionaries

While writing a little service I found that I'd like to build Python objects from dictionaries and then "serialize" them back into dictionaries. Currently my problem is the result of doing so using a ...
1
vote
1answer
40 views

Python: Comparing value overlap between keys in a dictionary

I have a dict like this: dict = defaultdict(list, {'a': [['1', '2', 'A', 'cat'], ['1', '3', 'A', 'dog']], 'b': [['1', '2', 'A', 'cat'], ...
0
votes
2answers
32 views

Updating Python dictionaries contents dynamically

I've been experimenting with python and more specifically dictionaries. I'm currently trying to add content created dynamically to a dictionary. I started by initializing the dictionary without any ...
0
votes
3answers
55 views

How to return a random value within a range, from a Map with Integer and List of Longs in Java

I am trying to find a way to get a random value from a provided list of different ranges using ThreadLocalRandom, and return that one random value from a method. I've been trying different approaches, ...
-1
votes
1answer
29 views

How to create a dictionary with key as a subclass of NSObject and values as an array? Swift

I want to create a dictionary where keys can be any subclass of NSObject and value is an array of NSObject subclass. I tried: class ABC: NSObject { var a: Int? = 0 convenience init(a: Int) {...
1
vote
1answer
17 views

How to correctly use pandas Series.map() with a dictionary of mappings?

The dataframe smaller_df looks like this: > smaller_df.head() MSA Code Line RPP 0 10180 1.0 91.2 1 10180 2.0 97.4 2 10180 3.0 78.7 3 10180 4.0 93.5 4 10420 ...
0
votes
1answer
10 views

Why using map in render slow/freeze app if there is a lot of entries?

I have a screen (n°1) with 1 button. When I click on it I have to wait from 1 to 4 seconds to see next screen (n°2) and it's really really slow and boring. I find the problem come from this line: {...
2
votes
2answers
47 views

How to fix KeyError when assigning regions to states in a dictionary

I am assigning regions to each individual state. My code reads from an excel file, and there are about 30k rows. I set up a dictionary assigning each state to a region as well as state abbreviations ...