Questions tagged [ordereddictionary]

1 votes
1 replies
How to extract data from salesforce ordereddict hierarchy using Python & Pandas
Summary In short, I need to extract data from a pandas series containing individual OrderedDicts. So far progress has been good but I have now h...
0 votes
0 replies
How to format Python Ordered-Dictionary in a tabular format
I am trying to format a Python Ordered Dictionary in a tabular format as shown below , How can i format the ordered dictionary data in the below...
0 votes
1 replies
Troubles with appending values in ordered dictionary from a loop
I'm attempting to write a program which takes a number of input sequences (strings) of variable length and counts the number of identical charact...
asked 1 month ago
1 votes
2 replies
Using Python to Create Complex JSON with the Creation of Some Nested Arrays being Conditional
In using Python to dynamically create part of a larger JSON string, I want to add an object (nested dictionary containing list and dictionaries o...
0 votes
1 replies
Dictionary that has shifted values
I have to define a function that shifts dictionary key values by n=1. For example: input : {'A' : 'A', 'B' : 'B', 'C' : 'C'} output : {'A' :...
asked 2 months ago
2 votes
2 replies
Dictionary sort by numer of days in month( in keys) in python
I am trying to sort dictionary by number of days in month. (30,31 and 28). i have tried to achieve this by calendar module and datetime module bu...
-1 votes
1 replies
merge complex list of nested dicts
I'm trying to merge nested Dicts in a list based on "name" like the following: [ { "name": "abc", "metadata": [ {...
asked 2 months ago
2 votes
1 replies
Making duplicate values unique in OrderedDict
Have an ordered dict which has duplicate key, value pairings. Want to make those duplicate values unique. For eg. 4244158 & 4244159 combinati...
-2 votes
1 replies
Print all paths to the keys and values in a nested OrderedDict with nested arrays
I'm trying to get the path from nested data structures with arrays and OderedDicts. The problem is that the function i found here: Find a given k...
3 votes
1 replies
Access to data from OrderedDict in Python and loop over it
I have an OrderedDict in my Django application which let to get content edition and content subversions for each edition. It looks like this: f...
0 votes
4 replies
Sorting a dictionary by values if it occurs once otherwise by keys
I have this dictionary and I need to sort the words by value. But when two or more words have the same value, I need to sort those words by alpha...
-1 votes
0 replies
Convert newtonsoft.json.linq.jobject to complex type
I'm trying to convert the JSON to an orderedDictionary so that later I can use it in my program this is how I read from the file: var obj = Jso...
asked 1 month ago
1 votes
1 replies
Looping through OrderedDict objects errors
I'm trying to learn how to manipulate python2.7 OrderedDict objects. I have an OrderedDict which was provided earlier in the program. I'm tryin...
asked 2 months ago
2 votes
1 replies
In python, how to order a dict with unicode content?
I've the following dict: <type 'dict'> {u'010-010': u'010-010_comp_v000', u'012-010': u'012-010_comp_v002', u'007-010': u'007-010_comp_v00...
0 votes
1 replies
Handling/Parsing complex nested JSON in Python
Using python, Trying to parse through every key value within the dictionary. I was able to parse key value where the value is in turn another dic...
0 votes
1 replies
Sorting or reordering OrderedDictionary<String, ImagePost> = [:] on ASCollectionNode - swift not working
Trying to sort OrderedDictionary - the format = var OrderedDictionary = [:], on a ASCollectionNode but not working. I tried using. but still no...
2 votes
1 replies
What is a time complexity of move_to_end operation for OrderedDict in Python 3?
I've found the source code and it seems to be O(1), since it's basically an update of a linked list and a dict. Though I'm not sure. What do you...
2 votes
1 replies
How would I append/merge/pair values of the same index or key and ignore values that don't have a matching index or key?
I am trying to pair/merge list values from two lists of the same index or key-value pair together. If the value does not have a key then it shoul...
asked 5 months ago
1 votes
1 replies
Save Shelf Dictionary-like object sorted by keys
I have huge dictionary with 100 000 keys and large numpy arrays as values. And i want to save it as file for faster loading purposes. I trie...
asked 6 months ago
-1 votes
1 replies
Parse an embedded object (JSON) into an ordered dictionary in Python
I am looking to parse some JSON into a dictionary but need to preserve order for one particular part of the dictionary. I know that I can parse...
0 votes
2 replies
How can I do to convert OrderedDict to Dict
I have a this list a = [OrderedDict([('a','b'), ('c','d'), ('e', OrderedDict([('a','b'), ('c','d') ]))])] and I want to convert the OrderedDi...
1 votes
2 replies
best_state changes with the model during training in pytorch
I want to save the best model and then load it during the test. So I used the following method: def train(): #training steps … if ac...
asked 2 weeks ago
-1 votes
0 replies
Extract all the values of a key based on the primary key id in a list of dictionaries
I have a list of Ordered dictionary like below: l = [OrderedDict([(u'id', u'5'), (u'name', u'Jack')]), OrderedDict([(u'id', u'6'), (u'name', u'...
asked 2 weeks ago
6 votes
4 replies
How to get position of key in a dictionary in python
If a key is present in a dictionary, I want to know what position the key is in i.e the numerical index. For example : if the dictionary consis...
asked 3 years ago