Created
November 1, 2017 22:49
-
-
Save jessienewell/09aed3619b50620ce3f4efe2fdbaceba to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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