Python Forum
Read json array data by pandas - Printable Version

+- Python Forum (https://python-forum.io)
+-- Forum: Python Coding (https://python-forum.io/forum-7.html)
+--- Forum: Data Science (https://python-forum.io/forum-44.html)
+--- Thread: Read json array data by pandas (/thread-25845.html)



Read json array data by pandas - vipinct - Apr-13-2020

we have an existing script to read json file from S3 and convert into parquet format, data receiving below format and we are able to read by below code,

json file content: [ {"Id":"123124","Account__c":"0ereeraw334U","Active__c":"true"} ]

existing code to convert into data frame: df = pd.read_json(obj['Body'],dtype='unicode',convert_dates=False)

But we are unable to read below json data in same way, getting incorrect data.

Json content: {"cust_land_detail":[ {"Id":"45634653","Account__c":"sersff23se","Active__c":"true"} ] }

NB: file has a root element, so unable to encode data.