Skip to content

Commit

Permalink
Utilise numpy.isin pour tester appartenance
Browse files Browse the repository at this point in the history
  • Loading branch information
Mauko Quiroga committed Jan 6, 2020
1 parent 78acd16 commit 611e762
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 5 deletions.
7 changes: 3 additions & 4 deletions openfisca_france/model/prestations/logement_social.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
from numpy import logical_not as not_, select
from numpy import isin, logical_not as not_, select
from numpy.core.defchararray import startswith

from openfisca_core.indexed_enums import Enum
Expand Down Expand Up @@ -68,9 +68,8 @@ class zone_logement_social(Variable):

def formula(menage, period):
depcom = menage('depcom', period)

in_paris_communes_limitrophes = sum([depcom == commune_proche_paris for commune_proche_paris in paris_communes_limitrophes])
in_idf = sum([startswith(depcom, departement) for departement in departements_idf])
in_paris_communes_limitrophes = isin(depcom, paris_communes_limitrophes)
in_idf = isin([True], startswith(depcom, departements_idf))

return select(
[
Expand Down
1 change: 0 additions & 1 deletion setup.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -17,4 +17,3 @@ in-place = true
addopts = --showlocals --exitfirst --doctest-modules --disable-pytest-warnings
testpaths = tests
python_files = **/*.py

0 comments on commit 611e762

Please sign in to comment.