I have the following data
{ "results": [
{
"company": "XYZ",
"createdAt": "2014-03-27T23:21:48.758Z",
"email": "abc@gmail.com",
"firstName": "abc",
"lastName": "xyz",
"linkedinAccount": "",
"location": "",
"profilePicture": {
"__type": "File",
"name": "ab0e-profilePicture",
"url": "url.url.com"
},
"registrationGate": "normal",
"telephone": "",
"title": "AA",
"updatedAt": "2014-03-27T23:24:20.220Z",
"username": "abc@gmail.com",
"zipcode": "00000"
}
]
}
I import the json data using the following code
import json
import pandas as pd
from pandas import DataFrame
json_data = pd.read_json('data.json')
print json_data[:2]
This prints
results
0 {u'linkedinAccount': u'', u'username': u'abc...
1 {u'linkedinAccount': u'zxcflcnv', u'username...
[2 rows x 1 columns]
when I try to print a column using
print df['linkedinAccount']
I get the following error
KeyError: u'no item named linkedinAccount'
How do I access data in the dataframes based on column names?