This is the python script i've built, in Jupyter Notebook, to query my own Instagram handle, but I cannot seem to get all of the data into a pandas dataframe, can anyone help me?
from instagram.client import InstagramAPI
import pandas as pd
import requests
import json
access_token = "xxxx"
client_secret = "xxxx"
recentMediaResponse = requests.get("https://api.instagram.com/v1/users/self/media/recent/",params = {"access_token": access_token})
recentMediaJson = json.loads(recentMediaResponse.text)
DataDF = pd.DataFrame(columns = ['numComments', 'likes', 'id', 'tags'])
numcomments = pd.DataFrame({'numComments' : [recentMediaJson['data'][1]['comments']['count']],
'likes': [recentMediaJson['data'][1]['likes']['count']],
'id': [recentMediaJson['data'][1]['id']],
'tags': [recentMediaJson['data'][1]['tags']]
})
Final = DataDF.append(numcomments)
print Final
When I print the 'Final' variable i only get one id and all of the corresponding data values/strings :
I know there's a lot of data because this is how the 'recentMediaJson' file looks: