Datasets

Data on bilateral trade flowing between nations fits right into the definition of a dataset with entities and relationships to explore. Katherine Barbieri, University of South Carolina, and Omar Keshk, Ohio State University, maintain a dataset that tracks the flow of trade between nations between 1870 and 2017. Amounts are converted to their equivalent US dollar values as of 2014.

The dataset is available publicly as part of The Correlates of War Project. Here is the link to the project: http://www.correlatesofwar.org/data-sets/bilateral-tradeWe will be using version 4.0 of this dataset in this chapter.

The IMF's Direction of Trade Statistics (DOTS) quarterly release shares trade data between nations and is a source from which the project aggregates data. It is important to specify that DOTS includes only the trade value of merchandise (or ready-to-sell goods) , as mentioned at this link: http://datahelp.imf.org/knowledgebase/articles/484354-why-is-the-trade-data-in-the-direction-of-trade-st.

Because the schema of the tabular dataset on the website is not in the form of timestamp, entity_A, entity_B, relationship_value_B, and other feature columns, I have created a Python script to transform the dataset before loading it into our Superset web app. First, clone the book's GitHub repository from this link: https://github.com/PacktPublishing/Superset-Quick-Start-Guide. Then, just go to Chapter06 and download file COW_Trade_4.0 and Dyadic_COW_4.0_modified.csv. You will also find the Python script and the original dataset from The Correlates of War Project website in the same directory for reference. Use the Upload a CSV feature to load the file.

Besides four column values of importer, exporter, trade flow, and year, the prepared dataset carries two features from the original, spike and dip. The definition of these columns, as given in the corresponding dataset document, is: a spike was considered to have occurred and labeled as 1, if the percentage change in flow at time t was greater than 50% and, simultaneously, the percentage change in flow at time t+1 was less than 50%.

A dip in trade values was considered to have occurred and was labeled as one, if the percentage change in flow at time t was less than 50% and, simultaneously, the percentage change in flow at time t+1 was greater than 50%. Before we move on to making charts, after uploading the COW_Trade_4.0 and Dyadic_COW_4.0_modified.csv files, make sure you update the Column attributes such that they reflect their use:

List Columns displaying the columns attributes
..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
3.144.86.134