Installing Pytrends and ranking markets
As a first step, we need to install the package that we will use to analyze the web search data. We will install the Pytrends package, which is a wrapper around the Google Trends API. To do this, open a new Jupyter notebook running Python 3.7, and in a new cell run the following command to install the package:
pip install pytrends
After the package has been installed, we can start the analysis. We can run several types of queries to the API, which are as follows:
- Interest over time
- Historical hourly interest
- Interest by region
- Related topics
- Related queries
- Trending searches
- Real-time search trends
- Top charts
- Suggestions
In this case, we want to obtain information about where the interest per region in a given set of terms is. These are steps that we will follow:
- Import the
pandas
package for storing the results and plotting the data. - Initialize the Pytrends API and we will pass...