The core of this project is centered on analyzing the effects of war on various socio-economic scales.
Required packages: pandas, numpy, requests, BeautifulSoup, typing, os, seaborn, matplotlib, keras, tensorflow, re
A brief note: the utils file contains utilities such as easy time series transformations used throughout the scripts. The testing file tests the html parsing requred to scrape the tables of Wikipedia
Run the scripts as follows:
- scrape_war_wiki constructs a list of wars dataset from Wikipedia pages which contain information about various wars.
- cpi_cleanup performs a brief cleanup on the CPI dataset (Consumer Price Index) which, if not in the repo at time of use, should be downloaded from the official government website.
- stocks_join aggregates the data from the DOW, Euronext 100, NASDAQ, NIKKEI 225, NYSE Composite, S&P 500, Shenzhen Component Index, and Shanghai Stock Exchange, data from which is stored in the repo currently. If not in the repo at time of use, use web_tables to (or manually) download from Yahoo Finance.
- process_gdps takes gdp information from MacroTrends (and another site, TheBalance, which has GDP information for the US before 1960 (the MacroTrends start date)) to aggregate into a single gdp csv which has the gdps in billions. process_gdps obtains the csvs itself.
- stocks_averages uses the cleaned CPI data and the processed GDP data to generate an index for global economic health by weighting the major indices according to market capitalisation and GDP of region.
- stocks_labelling transforms the index from 5, labelling each year with whether or not they are within certain wars using the dataset from scrape_war_wiki.
- visuals uses all of these transformations of data to generate data visualisations which answer our first two research questions.
- neural_network uses the dataset generated by stocks_labelling and the class
written in polynomials.py War to construct a Sequential neural network without
hyperparameter optimisation. Additionally, generates the coefficients of a polynomial
for the following 5 years of the global economic health index adjusted for inflation
- in the aftermath of the Russo-Ukrainian War - with respect to a given input in polynomial degree.