nested

Print nested list in a particular way

Print nested list in a particular way Question: I have this list: top_list = [[‘Recent news’, ’52’, ‘15.1’], [‘Godmorning’, ‘5’, ‘1.5’], [‘Sports news’, ’47’, ‘13.7’], [‘Report with weather’, ’34’, ‘9.9’], [‘The angel and the lawless’, ’33’, ‘9.6’], [‘Thundercats’, ‘3’, ‘0.9’], ["Mother’s legacy", ‘3’, ‘0.9’], [‘UR: Summer evenings with Europe of the Times’, ‘3’, ‘0.9’], [‘Tip’, …

Total answers: 1

in nested dictionary dynamically test if the value is a dictionary or a dictionary list

in nested dictionary dynamically test if the value is a dictionary or a dictionary list Question: I iterate through a nested dictionary taken from a json including one of the keys ("price") and sometimes a list sometimes a dictionary. Data={"main": {"sub_main": [ {"id": "995", "item": "850", "price": {"ref": "razorback", "value": "250"}}, {"id": "953", "item": "763", …

Total answers: 2

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

Converting nested JSON into a flattened DataFrame

Converting nested JSON into a flattened DataFrame Question: I have a data load in nested json format and I want to get a nested dataframe { "page_count": 21, "page_number": 1, "page_size": 300, "total_records": 6128, "registrants": [ { "id": "23lnTNqyQ3qkthfghjgkk", "first_name": "HUGO", "last_name": "MACHA ILLEN", "email": "[email protected]", "address": "", "city": "", "country": "", "zip": "", "state": …

Total answers: 1

Variable number of nested for loops in Python

Variable number of nested for loops in Python Question: I am having trouble getting this to work and any help would be greatly appreciated. I want to have a variable number of nested for loops for the following code. The idea is to write every combination possible to a csv file. here is my code: …

Total answers: 2

Any depth nested dict to pandas dataframe

Any depth nested dict to pandas dataframe Question: I’ve been fighting to go from a nested dictionary of depth D to a pandas DataFrame. I’ve tried with recursive function, like the following one, but my problem is that when I’m iterating over a KEY, I don’t know what was the pervious key. I’ve also tried …

Total answers: 2

How to distance between all points in list?

How to distance between all points in list? Question: I am plotting random points on a graph. I want to find the Eucildean distance from every point to another in a list. Previous result/attempt can be viewed here I generate 4 random numbers between 0 and 10 for the x and y coordinates, and then …

Total answers: 2

I want to loop this format using python

I want to loop this format using python Question: I have 3 lists a = ["1", "2", "3", "4", "5", "6"] b = [‘a’, ‘b’, ‘c’] c = ["13", "14"] and the format is: 1 3 a 2 13 b 3 13 c 4 14 a 5 14 b 6 14 c How do I …

Total answers: 2