I am trying to import and to convert a JSON into a DataFrame of Pandas. I am using the following code:
df=pd.read_json('df.json',typ='series')
df_2=pd.io.json.json_normalize(df)
But I have one problem, when I import the data I am obtaining some subsections like a list and I need to separate everything in columns. I dont know why my code is only separating in one subsection like these:
entitities.xxxxx, people.xxxxx
I mean, when I import the JSON I am having:
| entitites.hashtags |
-----------------------------------------
|[{u'index':[0,13],u'text':u'Oh my God'} |
And I would like to obtain
|entities.hastags.index|entities.hashtags.text|
-----------------------------------------------
| [0,13] | 'Oh my God' |
Thank you for your help.
UPDATED
A part of my JSON could be for example:
{
"text": "This is a nice test",
"truncated": false,
"entities": {
"hashtags": [{"index": [62, 67], "text": "Mis5"}],
"symbols": [],
"user_mentions": [
{
"screen_name": "Name",
"name": "Other name",
"id": 9999999,
"id_str": "771606164",
"index": [
3,
13
]
}
],
"urls": []
},
But not always the members have the same sucategories or nests