update
This commit is contained in:
parent
04fbef17b4
commit
cea17acfd5
@ -242,6 +242,10 @@ def generate_geography_dataset(dataset):
|
|||||||
date = item.get('date')
|
date = item.get('date')
|
||||||
value = int(float(item.get('value', 0)))
|
value = int(float(item.get('value', 0)))
|
||||||
|
|
||||||
|
year = int(date[:4])
|
||||||
|
if year < 2019:
|
||||||
|
continue # Skip this item if the year is less than 2019
|
||||||
|
|
||||||
# Replace country name if necessary
|
# Replace country name if necessary
|
||||||
country_name = country_replacements.get(name, 'Other')
|
country_name = country_replacements.get(name, 'Other')
|
||||||
|
|
||||||
@ -256,7 +260,7 @@ def generate_geography_dataset(dataset):
|
|||||||
# Convert the aggregated data back into the desired list format
|
# Convert the aggregated data back into the desired list format
|
||||||
dataset = [{'name': country, 'date': date, 'value': total_value} for (country, date), total_value in aggregated_data.items()]
|
dataset = [{'name': country, 'date': date, 'value': total_value} for (country, date), total_value in aggregated_data.items()]
|
||||||
|
|
||||||
print(dataset)
|
|
||||||
dataset = aggregate_other_values(dataset)
|
dataset = aggregate_other_values(dataset)
|
||||||
dataset = sorted(
|
dataset = sorted(
|
||||||
dataset,
|
dataset,
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user