Skip to content

Commit

Permalink
fix issues reported in validation tool
Browse files Browse the repository at this point in the history
  • Loading branch information
semio committed Jul 27, 2016
1 parent 083c5cb commit c7259d3
Showing 1 changed file with 13 additions and 3 deletions.
16 changes: 13 additions & 3 deletions etl/script/wdi.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,9 @@ def extract_concept_discrete(country, series):
# adding 'year' and 'country' concept
concepts_discrete = concepts_discrete.append(
pd.DataFrame([['country', 'Country', 'entity_domain'],
['year', 'Year', 'time']], index=[0, 53],
['year', 'Year', 'time'],
['name', 'Name', 'string'],
], index=[0, 53, 54],
columns=concepts_discrete.columns))

return concepts_discrete
Expand Down Expand Up @@ -136,8 +138,16 @@ def extract_datapoints_country_year(data):
datapoints = extract_datapoints_country_year(data)
for k, v in datapoints.items():
v.to_csv(
os.path.join(output_dir, 'ddf--datapoints--'+k+'--by--country--year.csv'),
index=False, encoding='utf8')
os.path.join(output_dir,
'ddf--datapoints--'+k+'--by--country--year.csv'),
index=False,
encoding='utf8',
# keep 10 digits. this is to avoid pandas
# use scientific notation in the datapoints
# and also keep precision. There are really
# small/big numbers in this datset.
float_format='%.10f'
)

print('generating index file...')
create_index_file(output_dir, os.path.join(output_dir, 'ddf--index.csv'))

0 comments on commit c7259d3

Please sign in to comment.