In [1]:
import pandas as pd
In [5]:
from itertools import product
In [21]:
import numpy as np
In [2]:
# create datapoints for trend_bridge
In [3]:
countries1 = ['usa', 'swe', 'chn', 'jpn']
countries2 = ['usa', 'swe', 'chn', 'gbd']
time1 = list(range(1990, 2000))
time2 = list(range(1995, 2005))
In [10]:
p1 = list(product(countries1, time1))
In [15]:
idx1 = pd.MultiIndex.from_tuples(p1, names=['country', 'year'])
In [20]:
idx1.shape[0]
Out[20]:
In [25]:
bstart = pd.DataFrame(np.ones(idx1.shape[0]), columns=['bridge_start']).set_index(idx1)
In [28]:
p2 = list(product(countries2, time2))
idx2 = pd.MultiIndex.from_tuples(p2, names=['country', 'year'])
bend = pd.DataFrame(np.ones(idx2.shape[0]) + 1, columns=['bridge_end']).set_index(idx2)
In [30]:
bstart.to_csv('ddf--datapoints--bridge_start--by--country--year.csv')
bend.to_csv('ddf--datapoints--bridge_end--by--country--year.csv')
In [31]:
!open .
In [ ]: