From 852efb311e55e24e0f83c9a0df02f746f4178713 Mon Sep 17 00:00:00 2001 From: Jeremy PASTOURET Date: Wed, 28 Aug 2024 15:56:18 +0200 Subject: [PATCH] =?UTF-8?q?fix:=20suppression=20du=20warning=20de=20divisi?= =?UTF-8?q?on=20par=20z=C3=A9ro=20en=20mettant=20infini=20si=20les=20resso?= =?UTF-8?q?urces=20sont=20=C3=A0=200?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- openfisca_paris/paris.py | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/openfisca_paris/paris.py b/openfisca_paris/paris.py index 447085a..12a2c3a 100644 --- a/openfisca_paris/paris.py +++ b/openfisca_paris/paris.py @@ -1,7 +1,7 @@ # -*- coding: utf-8 -*- from __future__ import division -from numpy import (maximum as max_, logical_not as not_, absolute as abs_, minimum as min_, select, where) +from numpy import (full_like as fl_, inf, divide as div_, zeros_like as zer_, maximum as max_, logical_not as not_, absolute as abs_, minimum as min_, select, where) from openfisca_france.model.base import * # noqa analysis:ignore @@ -226,8 +226,15 @@ def formula(famille, period, legislation): aspa_reference = famille('paris_aspa_reference', period) ressources = max_(aspa_reference, base_ressources) - return (loyer + charges_forfaitaires_logement - aide_logement) / ressources + # Utiliser si les ressources sont à 0 + ressources_inf = fl_(ressources, inf) + return div_( + (loyer + charges_forfaitaires_logement - aide_logement), + ressources, + out=ressources_inf, + where=ressources != 0 + ) class paris_condition_taux_effort(Variable): value_type = bool