Reputation: 793
I have the following in a python 3 numpy.ndarray:
{"_id" : "123", "text" : "some writing"}
{"_id" : "456", "text" : "some more writing"}
{"_id" : "789", "text" : "some more more writing"}
Question:
How do I delete {"_id" :
and "text" :
to get the following:
{"123", "some writing"}
{"456", "some more writing"}
{"789", "some more more writing"}
Upvotes: 0
Views: 51
Reputation: 199
the following was:
arr = [{"_id" : "123", "text" : "some writing"}, {"_id" : "456", "text" : "some more writing"}, {"_id" : "789", "text" : "some more more writing"}]
ans = [{i['_id']: i['text']}for i in arr]
Upvotes: 2