skip to Main Content

Function to return all related data from json list using any given key

I have the following json data about experts. result={ "experts":[ { "thumbnail": "https://scholar.googleusercontent.com/citations?view_op=small_photo&user=JicYPdAAAAAJ&citpid=2", "name": "Geoffrey Hinton", "link": "https://scholar.google.com/citations?hl=en&user=JicYPdAAAAAJ", "author_id": "JicYPdAAAAAJ", "email": "Verified email at cs.toronto.edu", "affiliations": "Emeritus Prof. Comp Sci, U.Toronto & Engineering Fellow, Google", "cited_by": 638900, "interests": [ {…

VIEW QUESTION

Python format json for saving to file

My data looks like this: Key1: [Key2:[{},{},...{}]] The code something like this: dict_={} dict_['Key2']=all_items dict_fin={} dict_fin['Ke1']=[dict_] df=pd.DataFrame(dict_fin) df.to_json(filepath, orient="records",lines=True) I would like to have saved json like this: { "Key1": [{"Key2" : [{},{},...,{}]}] } Instead, I get it like this:…

VIEW QUESTION

Json – Python flatten a dictionary column

It should be a simple line of code using pd.json_normalize function but it's working only with a single string and it's not batch processing my whole column Orginial dataframe df['addresses'][0] [{'addressLine1': '124 Main Street', 'addressLine2': '', 'addressLine3': '', 'city': 'Portland',…

VIEW QUESTION
Back To Top
Search