Skip to main content

All Questions

Tagged with
-4 votes
2 answers
124 views

Iterating over JSON containing lists of dictionaries in python [closed]

Please help in providing a solution to iterate through a JSON response containing lists of dictionaries in python: { "cart": [ { "id": "0Zy2jwLzQzlk7xq3", ...
Bonzo's user avatar
  • 9
0 votes
0 answers
39 views

Iterating through dictionary.items() seems to add foreign values to the dictionary

A simulated SevenSegment display for an LED-Matrix consist of seven virtual Segments. Though a single Segment is an object of its own class, it's basically just a dictionary storing pixel coordinates (...
Julian Fock's user avatar
-1 votes
1 answer
60 views

Iterating through dict and list2d, list_value gets replaced with a str

I am iterating through a dict and after that through a 2d list[list[float|int] then i am changing the values of the list2d to the corresponding in the dict randomly a str appears from the test i did ...
Navid Yaghmaei's user avatar
2 votes
2 answers
61 views

Is there any way to know when I'm passed the last item while iterating through a dictionary in django template?

I'm trying to create a text representation of a JSONField that has some data structured as an array of dictionaries like this: [ { "key1":"value1", "key2":"...
Parham Salamati's user avatar
1 vote
3 answers
135 views

How to iterate through a dictionary to get values on the lowest level?

Please help me understand how to extract the value of each ingredient for each product and do something with it. But for starters I just want to print them all one by one. MENU = { "product_1&...
Genkuru's user avatar
  • 21
0 votes
2 answers
63 views

Python - Iterating through nested dictionaries to populate a list based on values - Encounter 'str' object has no attribute 'items'

I'm creating a code that should allow a user to select multiple objects from a list. Each user has an allotted amount of space, and each object has a specified size. I'm trying to populate the list ...
Moonlyte Demon's user avatar
-1 votes
1 answer
138 views

How do map, filter, and find compare in terms of performance in JavaScript?

To perform a performance test for JavaScript's built-in higher-order functions for map, filter, find, you can use the performance.now() method to measure the time it takes to execute each operation. ...
Apurv's user avatar
  • 139
0 votes
2 answers
419 views

Function for converting columns of a data frame into key value pairs

I have a dataframe (these are just sample columns for reference, the actual number of columns is quite large) id A B C D 123 24 98 74 32 456 65 90 61 96 I would like to convert it into a data where id ...
Anusha Pal's user avatar
0 votes
3 answers
363 views

What is the most efficient way to increment all values of a dictionary in c#?

I have hundreds of dictionaries where all the values of all the dictionaries need to be incremented by 1. What is the most performant way to do that in C#? I thought of iterating through the keys ...
osman doluca's user avatar
0 votes
1 answer
59 views

Python overwriting dictionaries while iterating

I'm currently trying to write data to a json file. It's a dictionary with a nested dictionary inside. I'm iterating through jsonArray which is a list of dictionaries. Each dictionary has information ...
Nathan's user avatar
  • 13
1 vote
1 answer
53 views

How can I put the elements in the list next to the print out of the dictionary values?

DESIRED OUTPUT: Proportion of 1- letter words: 4.76% (1231 words) Proportion of 2- letter words: 16.14% (4177 words) Proportion of 3- letter words: 20.33% (5261 words) Proportion of 4- letter words: ...
Jordan Faulkner's user avatar
0 votes
3 answers
93 views

Printing to table form from a list and a nested list

psetHere is my code so far: MEDALS = 3 COUNTRIES = 8 # Create a list of country names. countries = [ "Canada", "Italy", "Germany", "Japan", "...
Jordan Faulkner's user avatar
0 votes
2 answers
203 views

Get the count of most occurring element in a list at every iteration

I need to fetch the most occurring ID in a list at every iteration I process the list. Its a huge list that contains positive/negative IDs. If ID is positive, increase the count for that ID; if ...
Neha Hattiholi's user avatar
-2 votes
1 answer
249 views

How to extract values from a python dictionary and use it in a function?

help is much appreciated! In python, I want to access the values only of specific keys in a dictionary and use them in a function. This is an example of the dictionary that I have: dict={'key1': ['a', ...
Kyle's user avatar
  • 11
-2 votes
2 answers
108 views

How to get the total duration of a project

I was given a list of dictionaries with different keys and values, one of them is the duration of an activity and each activity has predecessors, I need to calculate the total duration of the project ...
Ericka Salinas's user avatar

15 30 50 per page
1
2 3 4 5
34