Do not export line with empty value in statistics

This commit is contained in:
Yorick Barbanneau 2022-05-01 23:56:49 +02:00
parent 4efc272a59
commit 8eeea264d0

View file

@ -253,8 +253,14 @@ if __name__ == '__main__':
logger.debug('Process indicator {}'.format(regex))
selection = srow.filter(regex=regex)
for attribute, value in selection.items():
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('_'):
start,end = get_single_date(attribute)
else:
@ -263,7 +269,7 @@ if __name__ == '__main__':
if start is None or end is None:
logger.error('Can\'t process line, continue to next')
continue
logger.debug(
'town:{}, id_indic: {}, start: {}, end: {}, value:{}'
.format(
@ -302,7 +308,7 @@ if __name__ == '__main__':
export_csv(dep_capitals, args.export + '/cheflieudepartement.csv')
export_csv(states_capitals, args.export + '/cheflieuregion.csv')
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.get_times_by_tag()