From 1f89020c9dac100b8d4a0aaf139ff4b6f401b4d9 Mon Sep 17 00:00:00 2001 From: cgl Date: Thu, 9 Nov 2023 16:40:48 +0100 Subject: [PATCH 1/3] maj dependance --- setup.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/setup.py b/setup.py index a49ead52..e6348601 100644 --- a/setup.py +++ b/setup.py @@ -6,7 +6,7 @@ setup( name = "OpenFisca-France-Data", - version = "3.0.0", + version = "3.0.1", description = "OpenFisca-France-Data module to work with French survey data", long_description = long_description, long_description_content_type="text/markdown", @@ -42,7 +42,7 @@ python_requires = ">=3.9", install_requires = [ "multipledispatch >=0.6.0, <1.0.0", - "OpenFisca-France >=150.0.0, <155.0.0", + "OpenFisca-France >=155.0.0, <156.0.0", "openFisca-survey-manager >=2.0.0, <2.1.0", ], extras_require = { From 429f91be30059a313fe0e439da76ea5e48a42c01 Mon Sep 17 00:00:00 2001 From: cgl Date: Fri, 10 Nov 2023 14:58:44 +0100 Subject: [PATCH 2/3] renomme irpp en impot_revenu_restant_a_payer --- openfisca_france_data/__init__.py | 2 +- .../aggregats/france_entiere/france_entiere_2019.json | 2 +- .../aggregats/france_entiere/france_entiere_2020.json | 2 +- .../aggregats/france_entiere/france_entiere_2021.json | 2 +- .../aggregats/france_entiere/france_entiere_2022.json | 2 +- .../aggregats/france_entiere/france_entiere_2023.json | 2 +- .../aggregats/france_entiere/france_entiere_template.json | 2 +- .../assets/aggregats/ines/ines_2019.json | 2 +- .../assets/aggregats/ines/ines_2020.json | 2 +- openfisca_france_data/erfs/__init__.py | 2 +- .../old_openfisca_france_reforms/cesthra_invalidee.py | 4 ++-- tests/erfs_fpr/integration/test_impot_revenu.py | 6 +++--- tests/erfs_fpr/integration/test_pivot_table.py | 8 ++++---- tests/test_fake_survey_simulation.py | 4 ++-- 14 files changed, 21 insertions(+), 21 deletions(-) diff --git a/openfisca_france_data/__init__.py b/openfisca_france_data/__init__.py index 43389933..9b8d426c 100644 --- a/openfisca_france_data/__init__.py +++ b/openfisca_france_data/__init__.py @@ -174,7 +174,7 @@ def apply(self): 'csg', 'crds', 'impot_revenu', - 'irpp', + 'impot_revenu_restant_a_payer', 'prelevement_forfaitaire_unique_ir', 'prelevement_forfaitaire_liberatoire', 'taxe_habitation', diff --git a/openfisca_france_data/assets/aggregats/france_entiere/france_entiere_2019.json b/openfisca_france_data/assets/aggregats/france_entiere/france_entiere_2019.json index 55d37846..656e2d7d 100644 --- a/openfisca_france_data/assets/aggregats/france_entiere/france_entiere_2019.json +++ b/openfisca_france_data/assets/aggregats/france_entiere/france_entiere_2019.json @@ -166,7 +166,7 @@ "source": "Comptes de la sécurité sociale, résultats 2019 et prévision 2020 (https://www.securite-sociale.fr/files/live/sites/SSFR/files/medias/CCSS/2020/RAPPORT%20CCSS%20JUIN%202020.pdf)" }, { - "variable":"irpp", + "variable":"impot_revenu_restant_a_payer", "actual_beneficiaries":39332000, "actual_amount":76911000000, "source": "Statistiques DGFIP, Impôt sur le revenu : répartition par région (https://www.impots.gouv.fr/statistiques-impots-des-particuliers)" diff --git a/openfisca_france_data/assets/aggregats/france_entiere/france_entiere_2020.json b/openfisca_france_data/assets/aggregats/france_entiere/france_entiere_2020.json index 619edb0c..d2cbdf55 100644 --- a/openfisca_france_data/assets/aggregats/france_entiere/france_entiere_2020.json +++ b/openfisca_france_data/assets/aggregats/france_entiere/france_entiere_2020.json @@ -165,7 +165,7 @@ "source": "Comptes de la sécurité sociale, résultats 2020, prévisions 2021 et 2022 (https://www.securite-sociale.fr/files/live/sites/SSFR/files/medias/CCSS/2021/Rapport%20CCSS-Septembre2021.pdf)" }, { - "variable":"irpp", + "variable":"impot_revenu_restant_a_payer", "actual_beneficiaries":39888000, "actual_amount":73979000000, "source": "Statistiques DGFIP, Impôt sur le revenu : répartition par région (https://www.impots.gouv.fr/statistiques-impots-des-particuliers)" diff --git a/openfisca_france_data/assets/aggregats/france_entiere/france_entiere_2021.json b/openfisca_france_data/assets/aggregats/france_entiere/france_entiere_2021.json index 2d67b16a..ca3c69cd 100644 --- a/openfisca_france_data/assets/aggregats/france_entiere/france_entiere_2021.json +++ b/openfisca_france_data/assets/aggregats/france_entiere/france_entiere_2021.json @@ -163,7 +163,7 @@ "source":"Comptes de la sécurité sociale, résultats 2022 et prévisions 2023 (https://www.securite-sociale.fr/files/live/sites/SSFR/files/medias/DSS/2023/CCSS-Mai2023.pdf)" }, { - "variable":"irpp", + "variable":"impot_revenu_restant_a_payer", "actual_beneficiaries":40257000, "actual_amount":80826000000, "source": "Statistiques DGFIP, Impôt sur le revenu : répartition par région (https://www.impots.gouv.fr/statistiques-impots-des-particuliers)" diff --git a/openfisca_france_data/assets/aggregats/france_entiere/france_entiere_2022.json b/openfisca_france_data/assets/aggregats/france_entiere/france_entiere_2022.json index 9bf93e25..538ca5ad 100644 --- a/openfisca_france_data/assets/aggregats/france_entiere/france_entiere_2022.json +++ b/openfisca_france_data/assets/aggregats/france_entiere/france_entiere_2022.json @@ -164,7 +164,7 @@ "source":"Comptes de la sécurité sociale, résultats 2022 et prévisions 2023 (https://www.securite-sociale.fr/files/live/sites/SSFR/files/medias/DSS/2023/CCSS-Mai2023.pdf)" }, { - "variable":"irpp", + "variable":"impot_revenu_restant_a_payer", "actual_beneficiaries": 0, "actual_amount": 0, "source": "" diff --git a/openfisca_france_data/assets/aggregats/france_entiere/france_entiere_2023.json b/openfisca_france_data/assets/aggregats/france_entiere/france_entiere_2023.json index c66ec02a..0c7e2cc7 100644 --- a/openfisca_france_data/assets/aggregats/france_entiere/france_entiere_2023.json +++ b/openfisca_france_data/assets/aggregats/france_entiere/france_entiere_2023.json @@ -158,7 +158,7 @@ "source":"Comptes de la sécurité sociale, résultats 2022 et prévisions 2023 (https://www.securite-sociale.fr/files/live/sites/SSFR/files/medias/DSS/2023/CCSS-Mai2023.pdf)" }, { - "variable":"irpp", + "variable":"impot_revenu_restant_a_payer", "actual_beneficiaries": 0, "actual_amount": 0, "source": "" diff --git a/openfisca_france_data/assets/aggregats/france_entiere/france_entiere_template.json b/openfisca_france_data/assets/aggregats/france_entiere/france_entiere_template.json index d3e4da85..3adf627d 100644 --- a/openfisca_france_data/assets/aggregats/france_entiere/france_entiere_template.json +++ b/openfisca_france_data/assets/aggregats/france_entiere/france_entiere_template.json @@ -157,7 +157,7 @@ "source": "" }, { - "variable":"irpp", + "variable":"impot_revenu_restant_a_payer", "actual_beneficiaries": 0, "actual_amount": 0, "source": "" diff --git a/openfisca_france_data/assets/aggregats/ines/ines_2019.json b/openfisca_france_data/assets/aggregats/ines/ines_2019.json index a7273d98..2d7549a2 100644 --- a/openfisca_france_data/assets/aggregats/ines/ines_2019.json +++ b/openfisca_france_data/assets/aggregats/ines/ines_2019.json @@ -132,7 +132,7 @@ "actual_amount":17000000000 }, { - "variable":"irpp", + "variable":"impot_revenu_restant_a_payer", "actual_beneficiaries":0, "actual_amount":69400000000, "notes":"Impot payé en 2019, en parti sur revenus 2019 et 2018" diff --git a/openfisca_france_data/assets/aggregats/ines/ines_2020.json b/openfisca_france_data/assets/aggregats/ines/ines_2020.json index ba52c2f4..2534af82 100644 --- a/openfisca_france_data/assets/aggregats/ines/ines_2020.json +++ b/openfisca_france_data/assets/aggregats/ines/ines_2020.json @@ -132,7 +132,7 @@ "actual_amount":19000000000 }, { - "variable":"irpp", + "variable":"impot_revenu_restant_a_payer", "actual_beneficiaries":0, "actual_amount":73900000000, "notes":"Impot payé en 2020, en parti sur revenus 2020 et 2019" diff --git a/openfisca_france_data/erfs/__init__.py b/openfisca_france_data/erfs/__init__.py index 2debdb5e..124290a8 100644 --- a/openfisca_france_data/erfs/__init__.py +++ b/openfisca_france_data/erfs/__init__.py @@ -3,7 +3,7 @@ def get_of2erf(year=None): of2erf["csg"] = "csgim" # imposable, et "csgdm", déductible #of2erf["csgd"] = "csgdm" of2erf["crds"] = "crdsm" - of2erf["irpp"] = "zimpom" + of2erf["impot_revenu_restant_a_payer"] = "zimpom" of2erf["ppe"] = "m_ppem" of2erf["af"] = "m_afm" #af_base diff --git a/openfisca_france_data/reforms/old_openfisca_france_reforms/cesthra_invalidee.py b/openfisca_france_data/reforms/old_openfisca_france_reforms/cesthra_invalidee.py index 66a5ecea..505bcac5 100644 --- a/openfisca_france_data/reforms/old_openfisca_france_reforms/cesthra_invalidee.py +++ b/openfisca_france_data/reforms/old_openfisca_france_reforms/cesthra_invalidee.py @@ -31,7 +31,7 @@ def formula(foyer_fiscal, period, parameters): return foyer_fiscal.sum(cesthra_i) -class irpp(Variable): +class impot_revenu_restant_a_payer(Variable): label = 'Impôt sur le revenu des personnes physiques (réformée pour intégrer la cesthra)' definition_period = YEAR @@ -62,5 +62,5 @@ class cesthra_invalidee(Reform): def apply(self): self.add_variable(cesthra) - self.update_variable(irpp) + self.update_variable(impot_revenu_restant_a_payer) self.modify_parameters(modifier_function = modify_parameters) diff --git a/tests/erfs_fpr/integration/test_impot_revenu.py b/tests/erfs_fpr/integration/test_impot_revenu.py index c3f8fa68..08c828ca 100644 --- a/tests/erfs_fpr/integration/test_impot_revenu.py +++ b/tests/erfs_fpr/integration/test_impot_revenu.py @@ -5,7 +5,7 @@ data_frame_by_entity = survey_scenario.create_data_frame_by_entity( variables = [ - 'irpp', + 'impot_revenu_restant_a_payer', 'maries_ou_pacses', 'nbptr', 'rfr', @@ -31,8 +31,8 @@ assert 25e6 < (foyer_fiscal.weight_foyers).sum() -print(foyer_fiscal.groupby('nbptr').apply(lambda x: (x.irpp.astype('float') * x.weight_foyers.astype('float')).sum())) -print((foyer_fiscal.irpp.astype('float') * foyer_fiscal.weight_foyers.astype('float')).sum() / 1e9) +print(foyer_fiscal.groupby('nbptr').apply(lambda x: (x.impot_revenu_restant_a_payer.astype('float') * x.weight_foyers.astype('float')).sum())) +print((foyer_fiscal.impot_revenu_restant_a_payer.astype('float') * foyer_fiscal.weight_foyers.astype('float')).sum() / 1e9) # survey_scenario.summarize_variable('salaire_imposable') # salaire_imposable: 1 periods * 127126 cells * item size 4 (float32, default = 0) = 496.6K diff --git a/tests/erfs_fpr/integration/test_pivot_table.py b/tests/erfs_fpr/integration/test_pivot_table.py index 81b0bc04..0e867df8 100644 --- a/tests/erfs_fpr/integration/test_pivot_table.py +++ b/tests/erfs_fpr/integration/test_pivot_table.py @@ -10,7 +10,7 @@ def test_pivot_table_1d_mean(): survey_scenario = get_survey_scenario(kind = 'erfs_fpr', year = year) pivot_table = survey_scenario.compute_pivot_table( columns = ['decile_rfr'], - values = ['irpp'], + values = ['impot_revenu_restant_a_payer'], period = year, ) return pivot_table @@ -22,7 +22,7 @@ def test_pivot_table_1d_sum(): pivot_table = survey_scenario.compute_pivot_table( aggfunc = 'sum', columns = ['decile_rfr'], - values = ['irpp'], + values = ['impot_revenu_restant_a_payer'], period = year, ) return pivot_table @@ -34,7 +34,7 @@ def test_pivot_table_1d_count(): pivot_table = survey_scenario.compute_pivot_table( aggfunc = 'count', columns = ['decile_rfr'], - values = ['irpp'], + values = ['impot_revenu_restant_a_payer'], period = year, ) return pivot_table @@ -46,7 +46,7 @@ def test_pivot_table_2d_2values(): pivot_table = survey_scenario.compute_pivot_table( columns = ['decile_rfr'], index = ['nbptr'], - values = ['irpp', 'rfr'], + values = ['impot_revenu_restant_a_payer', 'rfr'], period = year, ) return pivot_table diff --git a/tests/test_fake_survey_simulation.py b/tests/test_fake_survey_simulation.py index 9eacf4d0..7f7f8595 100644 --- a/tests/test_fake_survey_simulation.py +++ b/tests/test_fake_survey_simulation.py @@ -221,7 +221,7 @@ def test_calculate_irpp_before_and_after_plf2015( # IRPP avant la réforme assert_near( - survey_scenario.calculate_variable("irpp", use_baseline = True, period = year), + survey_scenario.calculate_variable("impot_revenu_restant_a_payer", use_baseline = True, period = year), [-10124, -869], error_margin, ) @@ -229,7 +229,7 @@ def test_calculate_irpp_before_and_after_plf2015( # IRPP après la réforme # -911.4 + (1135 - 911.4) = -686.8 assert_near( - survey_scenario.calculate_variable("irpp", period = year), + survey_scenario.calculate_variable("impot_revenu_restant_a_payer", period = year), [-10118, -911.4 + (1135 - 911.4)], error_margin, ) From 2c21826c5b2a514a25e760a0412fce473cccf141 Mon Sep 17 00:00:00 2001 From: cgl Date: Fri, 10 Nov 2023 15:06:33 +0100 Subject: [PATCH 3/3] update changelog --- CHANGELOG.md | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index bfd72c1a..babc6c37 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,9 @@ # Changelog +### 3.0.1 [#242](https://github.com/openfisca/openfisca-france-data/pull/242) +* Technical changes: +- Passage à Openfsca-France >= 155.0.0 + ### 3.0.0 [#241](https://github.com/openfisca/openfisca-france-data/pull/241) - Breaking changes