Forked from eliasdabbas/brands_knowledge_graph.py
Created
September 21, 2022 03:04
-
-
Save mehranattari/e88896c15c6ae5212d696ad5aadb3402 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
import advertools as adv | |
import pandas as pd | |
key = 'YOUR_GOOGLE_KEY' | |
brands = [ | |
'nike', | |
'adidas', | |
'puma', | |
'asics', | |
'columbia', | |
'diadora', | |
'fila', | |
] | |
languages = ['en', 'fr', 'it', 'de', 'pt', 'es'] | |
sports = adv.knowledge_graph( | |
key=key, | |
query=brands, | |
languages=languages) | |
brand = brands[i] # <--- change to get a different chart | |
(sports[sports['query'].eq(brand)] | |
.groupby(['query', 'languages']) | |
.head() | |
.head(50) | |
.reset_index(drop=True) | |
[['query', 'languages', 'resultScore', 'result.description']] | |
.style.format({'resultScore': '{:,.0f}'}) | |
.bar()) | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment