Skip to content

Instantly share code, notes, and snippets.

@jessienewell
Created November 1, 2017 22:49
Show Gist options
  • Save jessienewell/09aed3619b50620ce3f4efe2fdbaceba to your computer and use it in GitHub Desktop.
Save jessienewell/09aed3619b50620ce3f4efe2fdbaceba to your computer and use it in GitHub Desktop.
interest_dict = {}
for tag in top_hashtags.index:
api.getHashtagFeed(tag)
result = api.LastJson
interest_dict[tag] = result
urls = []
num_likes = []
tags = []
for tag in interest_dict.keys():
items = interest_dict[tag]['items']
for i in items:
if 'image_versions2' in i:
urls.append(i['image_versions2']['candidates'][1]['url'])
num_likes.append(i['like_count'])
tags.append(tag)
df_tags = pd.DataFrame(
{'urls': urls,
'num_likes': num_likes,
'tag': tags
})
top_tags = df_tags.groupby('tag').max()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment