Skip to content

Commit

Permalink
ajoute france_enitre dans aggregates
Browse files Browse the repository at this point in the history
  • Loading branch information
clallemand committed Sep 1, 2023
1 parent 17a644c commit 98f7c62
Showing 1 changed file with 19 additions and 0 deletions.
19 changes: 19 additions & 0 deletions openfisca_france_data/aggregates.py
Original file line number Diff line number Diff line change
Expand Up @@ -107,4 +107,23 @@ def load_actual_data(self, year = None):

result = result[["variable","actual_amount","actual_beneficiaries"]].set_index("variable")

elif target_source == "france_entiere":
ines_aggregates_file = Path(
pkg_resources.get_distribution("openfisca-france_data").location,
"openfisca_france_data",
"assets",
"aggregats",
"france_entiere",
f"france_entiere_{year}.json"
)

with open(ines_aggregates_file, 'r') as f:
data = json.load(f)

result = pd.DataFrame(data['data']).drop(['source', 'notes'], axis = 1)
result['actual_beneficiaries'] = result. actual_beneficiaries / self.beneficiaries_unit
result['actual_amount'] = result. actual_amount / self.amount_unit

result = result[["variable","actual_amount","actual_beneficiaries"]].set_index("variable")

return result

0 comments on commit 98f7c62

Please sign in to comment.