Python Notebooks

Getting Started

Welcome to our comprehensive guide on utilizing Python notebooks for accessing trade data through our API. This resource is meticulously designed for both national and international datasets, offering an extensive range of data for your analysis and research needs. To delve into national trade datasets, users are required to obtain an API key, ensuring secure and personalized access to the data. Our Python notebooks provide a user-friendly and efficient way to interact with these datasets, making it easier for you to analyze, visualize, and draw insights from the trade information. Whether you're a seasoned data analyst or just starting out, these notebooks will serve as a valuable tool in your exploration of trade data. Let's get started on unlocking the full potential of this rich and diverse data source!
Please Note:
Any notebooks that utilize data from the national datasets will require the use an API key which can be obtained by purchasing an OEC pro subscription.

List of OEC Notebooks

Downloading International Data

In this Python Notebook, we embark on a comprehensive journey through the intricacies of international trade data analysis. We begin by teaching you how to generate API URLs using the Data Explorer, a crucial step for accessing the Observatory of Economic Complexity (OEC) database. This is followed by a guide on how to download international trade data, ensuring you have the raw data needed for in-depth analysis. Next, we delve into trade data manipulation, demonstrating techniques to clean and organize the data for better understanding. The fourth part of the notebook covers trade data statistics, providing tools and methods to analyze and interpret key trade figures. Finally, we conclude with trade data visualization, where you'll learn to create compelling visual representations of the data, making it easier to communicate your findings and insights. This notebook is a holistic guide designed to enhance your understanding of global trade patterns and support informed decision-making in the field of international economics.
Open in Google Colab

Downloading Subnational Data

In the this Python Notebook, you'll get an in-depth look at the Observatory of Economic Complexity's (OEC) regional trade data, designed to jumpstart your trade analysis journey. This notebook guides you through a series of structured steps, beginning with generating API URLs using the Data Explorer. This initial phase is crucial for accessing detailed regional trade data. Following this, the notebook leads you through the process of downloading international trade data, ensuring you have comprehensive and specific datasets at your disposal. The subsequent section on trade data manipulation provides insightful techniques for cleaning and organizing this data, making it more accessible and understandable. Delving into trade data statistics, the notebook then offers robust tools and methods to analyze and interpret significant trade figures, particularly at the subnational level. Lastly, the journey culminates with trade data visualization, teaching you to craft effective visual representations of your data, thereby enhancing the clarity and impact of your analytical conclusions. This notebook serves as an essential tool for anyone aiming to delve into the nuances of regional trade analysis.
Open in Google Colab

ECI, PCI, and Relatedness Calculation on International Data

In this Python Notebook, we explore the Economic Complexity Index (ECI), Product Complexity Index (PCI), and the concept of Relatedness within international trade. Drawing from a research paper, the notebook provides a comprehensive guide starting from downloading and cleaning international trade data, to calculating ECI and PCI, which are vital in understanding an economy's capacity and the intricacies of producing various products. The concept of Relatedness is also explored, assessing the compatibility between an economy and a specific activity, crucial for predicting economic changes in regions. The notebook culminates with a visualization of ECI versus GDP, offering insights into the relationship between economic complexity and overall economic performance, making it a valuable resource for economists and researchers in international trade analysis.
Open in Google Colab
Have questions, comments, or concerns?
Send us an e-mail: [email protected]
Follow @OECtoday on
Created, Designed, and Developed by:
In collaboration with