for k, df in dps.items(): df_ = df.reset_index().dropna() yield k, df_ if __name__ == '__main__': print('reading source files...') data = pd.read_excel(source, skiprows=2, sheetname='KILM 16b') print('creating concept file...') cdf = extract_concepts(data) path = os.path.join(out_dir, 'ddf--concepts.csv') cdf.to_csv(path, index=False) print('creating entities files...') country = extract_entities_country(data) path = os.path.join(out_dir, 'ddf--entities--country.csv') country.to_csv(path, index=False) print('creating datapoints...') for k, df in extract_datapoints(data): path = os.path.join(out_dir, 'ddf--datapoints--{}--by--country--year.csv'.format(k)) df.to_csv(path, index=False) print('creating index file...') create_index_file(out_dir) print('Done.')
dps.columns = ['country', 'year', to_concept_id(conc)] dps['country'] = dps['country'].map(to_concept_id) return to_concept_id(conc), dps.dropna() if __name__ == '__main__': print('reading source files...') data = pd.read_excel(source, skiprows=2, sheetname='KILM 07b') print('creating concept files...') cdf = extract_concepts(data) path = os.path.join(out_dir, 'ddf--concepts.csv') cdf.to_csv(path, index=False) print('creating entities files...') country = extract_entities_country(data) path = os.path.join(out_dir, 'ddf--entities--country.csv') country.to_csv(path, index=False) print('creating datapoints files...') k, datapoints = extract_datapoints(data) path = os.path.join(out_dir, 'ddf--datapoints--{}--by--country--year.csv'.format(k)) datapoints.to_csv(path, index=False) print('creating index file...') create_index_file(out_dir) print('Done.')