Do not export line with empty value in statistics
This commit is contained in:
parent
4efc272a59
commit
8eeea264d0
1 changed files with 8 additions and 2 deletions
|
@ -253,8 +253,14 @@ if __name__ == '__main__':
|
||||||
|
|
||||||
logger.debug('Process indicator {}'.format(regex))
|
logger.debug('Process indicator {}'.format(regex))
|
||||||
selection = srow.filter(regex=regex)
|
selection = srow.filter(regex=regex)
|
||||||
|
|
||||||
for attribute, value in selection.items():
|
for attribute, value in selection.items():
|
||||||
logger.debug('check code: {}'.format(irow['code']))
|
logger.debug('check code: {}'.format(irow['code']))
|
||||||
|
|
||||||
|
# If value is NaN, then do not add the line
|
||||||
|
if pd.isna(value):
|
||||||
|
continue
|
||||||
|
|
||||||
if irow['code'].startswith('_'):
|
if irow['code'].startswith('_'):
|
||||||
start,end = get_single_date(attribute)
|
start,end = get_single_date(attribute)
|
||||||
else:
|
else:
|
||||||
|
@ -263,7 +269,7 @@ if __name__ == '__main__':
|
||||||
if start is None or end is None:
|
if start is None or end is None:
|
||||||
logger.error('Can\'t process line, continue to next')
|
logger.error('Can\'t process line, continue to next')
|
||||||
continue
|
continue
|
||||||
|
|
||||||
logger.debug(
|
logger.debug(
|
||||||
'town:{}, id_indic: {}, start: {}, end: {}, value:{}'
|
'town:{}, id_indic: {}, start: {}, end: {}, value:{}'
|
||||||
.format(
|
.format(
|
||||||
|
@ -302,7 +308,7 @@ if __name__ == '__main__':
|
||||||
export_csv(dep_capitals, args.export + '/cheflieudepartement.csv')
|
export_csv(dep_capitals, args.export + '/cheflieudepartement.csv')
|
||||||
export_csv(states_capitals, args.export + '/cheflieuregion.csv')
|
export_csv(states_capitals, args.export + '/cheflieuregion.csv')
|
||||||
export_csv(indicators, args.export + '/indicateur.csv', True)
|
export_csv(indicators, args.export + '/indicateur.csv', True)
|
||||||
export_csv(consolidated_stats, args.export + '/statistiques.csv')
|
export_csv(consolidated_stats, args.export + '/statistique.csv')
|
||||||
t.stop()
|
t.stop()
|
||||||
|
|
||||||
t.get_times_by_tag()
|
t.get_times_by_tag()
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue