I'm working with data returned from the twitter API for tweets, which returns data that is very nested for certain elements. One of these elements, the entities, contains annotations, hashtags, mentions and urls. I only care about the urls, so I passed the following statement:
data = json_response['data']
dict_flattened = (flatten(record, '.', root_keys_to_ignore={'mentions', 'hashtags', 'annotations'}) for record in data)
Doing so did remove some columns that were being returned, but I am still receiving data back from within those root keys. Am I just calling this incorrectly? Attaching output that was sent to a csv.
json_response_flatten.zip
Here is the output without specifying root keys to ignore:
json_response_flatten include all.zip
I'm working with data returned from the twitter API for tweets, which returns data that is very nested for certain elements. One of these elements, the entities, contains annotations, hashtags, mentions and urls. I only care about the urls, so I passed the following statement:
Doing so did remove some columns that were being returned, but I am still receiving data back from within those root keys. Am I just calling this incorrectly? Attaching output that was sent to a csv.
json_response_flatten.zip
Here is the output without specifying root keys to ignore:
json_response_flatten include all.zip