Skip to main content

All Questions

Tagged with
Filter by
Sorted by
Tagged with
0 votes
1 answer
244 views

flatten a complex dict, while compressing keys using dot as a separator

I'm trying come up with a python3 function (using existing libs also works, of course) that would flatten this input: { 'key1': 1, 'key2dict': {'subkey1': 1, 'subkey2': 2}, 'key3listOfDict': [ ...
shachar0n's user avatar
  • 175
2 votes
1 answer
387 views

Flatten nested xml using xslt

I am facing challenging to flatten a nested xml file using xslt. Input xml: <?xml version="1.0" encoding="UTF-8"?> <group xmlns="http://group.com/group"> &...
Ashish's user avatar
  • 27
0 votes
3 answers
1k views

Flatten the nested dictionary, which has list also, into a dictionary

I have a nested dictionary with a list inside of it such as {'Ka': {'Ka': ['0.80', '0.1'], 'Ba': ['0.50', '1.1'], 'FC': ['0.78', '0.0'], 'AA': ['0.66', '8.1']}, 'AL': {'AR': ['2.71', '7.3'], '...
Yag_r's user avatar
  • 67
0 votes
1 answer
65 views

Python: Convert Nested Array to Newly Formatted Nested Array Based on Column Position [duplicate]

Let's say I have a nested array like so: array = [[1,7], [49, 9], [3, 80], [13, 15]] From the above array, I want to create two new arrays (within a nested array) based on vertical "columns"...
PineNuts0's user avatar
  • 5,234
0 votes
0 answers
131 views

Flattening list of dicts columns from a converted Json file to Dataframe

I'm trying to convert a Json file to a Dataframe using Pandas and json_normalize. The json file is like this: enter image description here Then my Dataframe is like this after reading the file and ...
MGH's user avatar
  • 9
0 votes
0 answers
86 views

Python flattening json to long, not wide - with nested lists and nested jsons

I've tried flattening with pandas df = pd.DataFrame([flatten_json(data[key]) for key in data.keys()]) but get a single row of wide data. I need long data while preserving the values of some higher ...
Shelley's user avatar
  • 19
1 vote
1 answer
120 views

How to flatten this Dataframe

I have Dataframe that consists of ID and one column. That column has list of dictionaries in each cell. What I want is normalize it and flatten, so instead of having one column, I will have many of ...
D4w1d's user avatar
  • 125
1 vote
1 answer
837 views

Flatten and sort a nested JSON object into an array in javascript

I have an object like: { '2021': { '08': { '26': [{'name': 'Bob', age: 34}, {'name': 'Alice', age: 33}], '27': [{'name': 'Jane', age: 21}] }, '09': { '03': [{'name': '...
user1087973's user avatar
  • 1,136
0 votes
2 answers
1k views

Flatten nested JSON object

I have a json object like this: const people = { name: 'My Name', cities: [{city: 'London', country: 'UK'},{city: 'Mumbai', country: 'IN'},{city: 'New York', country: 'US'}], } I would like the ...
Sasi C's user avatar
  • 23
0 votes
1 answer
275 views

Parse nested JSON and iterate into Pandas Dataframe

I'm using a Foursquare API call to find venues associated with particular ZIP codes in the US. I am able to generate the JSON with information, but am having trouble looping and parsing to construct a ...
ADH's user avatar
  • 47
0 votes
2 answers
307 views

pandas: how to remove duplicates from a deeply nested list of lists

I have a panda dataframe like the following: df = pd.DataFrame({ 'text':['the weather is nice though', 'How are you today','the beautiful girl and the nice boy']}) df['sentence_number'] = df.index + 1 ...
zara kolagar's user avatar
0 votes
2 answers
412 views

Flatten JSON / Dictionaries / List

I have a nested JSON { "ID": 300, "Name": " TEST", "Value": [ { "Details": [ { &...
nomad's user avatar
  • 33
0 votes
2 answers
753 views

Parse multiple json files, flatten data and save as json

I have multiple number of json files saved in a folder. I would like to parse each json file, use the library flatten and save as a seperate json file. I have managed to do this with one json, but ...
Lilly's user avatar
  • 25
4 votes
2 answers
286 views

Generify transformation of hierarchical array into a flat array

I'm trying to generify the transformation of a hierarchical array into a flat array. I have this kind of object which has children of the same type, which has children of the same type etc.. [{ ...
Dotista's user avatar
  • 441
3 votes
3 answers
2k views

Extract set of leaf values found in nested dicts and lists excluding None

I have a nested structure read from YAML which is composed of nested lists and/or nested dicts or a mix of both at various levels of nesting. It can be assumed that the structure doesn't contain any ...
Asclepius's user avatar
  • 63.8k

15 30 50 per page