Normalize flatten
See original GitHub issueI think it would greatly simplify downstream usage of twarc.expansions.flatten in plugins if flatten() always returned a list of tweet objects regardless of whether it was passed a bundled tweet {"data": {}}
, a bundled list of tweets {"data": [{...}]}
or an already flattened tweet {"id": "..."}
.
Issue Analytics
- State:
- Created 2 years ago
- Comments:7 (7 by maintainers)
Top Results From Across the Web
All Pandas json_normalize() you should know for flattening ...
In this article, you'll learn how to use Pandas's built-in function json_normalize() to flatten those 2 types of JSON into Pandas DataFrames ...
Read more >Python Pandas - Flatten nested JSON - GeeksforGeeks
Max number of levels(depth of dict) to normalize. ... Use pandas json_normalize on this JSON data structure to flatten it to a flat...
Read more >Flatten nested JSON with pandas.json.normalize()
Any idea how to make the json_normalize function of pandas more flexible and independent of entries of the json response? python · json...
Read more >pandas.json_normalize — pandas 1.5.2 documentation
Normalize semi-structured JSON data into a flat table. Parameters. datadict or list of dicts. Unserialized JSON objects. record_pathstr or list of str, ...
Read more >Flatten / Normalize Nested JSON Data - Kaggle
Hey all,. Just did a quick blog post on how to flatten / normalize any nested JSON to structured relational tables for analysis....
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Thanks for those pointers @igorbrigadir – it would be great if they solved this problem for us. But I think we should move forward with our own solution until it materializes.
Because it is seen as additive, not destructive, I’m pretty sure flatten() returns the same structure it was given, e.g
{"data": []}
or{"data": {}}
. It can be a bit tedious to have to unpack that in plugins, and I found myself copy pasting the same code.After a night’s sleep I think @SamHames is right and that flatten should be left as non-destructive, and what is needed is something new that will create a singular JSON representation based off of either the v1 or v2 representation. So I’m going to close this and focus on #412 instead. It’s just a bigger job because I need to read the standard more closely.