Analyzing our spatiotemporal datasets
Our Burkina Faso market dataset is conveniently broken into quarters, and to understand quarter-by-quarter changes, it makes sense to set our window size as four quarters (a year) with a three-quarter overlap (to focus on monthly changes). As we did in Chapter 2, we’ll calculate the local Moran statistic through the weight matrix and correlation metric. Let’s set up our needed packages and import our Burkina Faso Market dataset plus its weight matrix with Script 7.1
:
#import packages import igraph as ig from igraph import Graph import numpy as np import pandas as pd import os import matplotlib.pyplot as plt #import Burkina Faso market millet prices File="C:/users/njfar/OneDrive/Desktop/BF_Millet.csv" pwd=os.getcwd() os.chdir(os.path.dirname(File)) mydata=pd.read_csv(os.path.basename(File),encoding='latin1') #import weight matrix of Burkina Faso markets File="C:/users/njfar/OneDrive/Desktop/weights_bk.csv...