Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
leximpact-server
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Container registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
GitLab community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
leximpact
Simulateur dotations aux communes
leximpact-server
Commits
d0745e28
Commit
d0745e28
authored
Sep 22, 2022
by
benoit-cty
Browse files
Options
Downloads
Patches
Plain Diff
Fix style
parent
9909f6a0
No related branches found
No related tags found
1 merge request
!77
PLF 2023
Pipeline
#6116
passed
Sep 22, 2022
Stage: init
Stage: check
Stage: test
Stage: deploy
Changes
3
Pipelines
1
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
Simulation_engine/TransformData.py
+3
-3
3 additions, 3 deletions
Simulation_engine/TransformData.py
Simulation_engine/simulate_pop_from_reform.py
+5
-3
5 additions, 3 deletions
Simulation_engine/simulate_pop_from_reform.py
scripts/update_cache.py
+2
-2
2 additions, 2 deletions
scripts/update_cache.py
with
10 additions
and
8 deletions
Simulation_engine/TransformData.py
+
3
−
3
View file @
d0745e28
This diff is collapsed.
Click to expand it.
Simulation_engine/simulate_pop_from_reform.py
+
5
−
3
View file @
d0745e28
...
...
@@ -103,7 +103,7 @@ def load_data(filename: Optional[str]):
print
(
f
"
Loading from file
{
path
}
or from table
{
filename
}
"
)
if
filename
[
-
3
:]
==
"
.h5
"
or
filename
[
-
4
:]
==
"
.hdf
"
:
return
pandas
.
read_hdf
(
path
)
elif
"
.csv
"
in
filename
:
elif
"
.csv
"
in
filename
or
"
.zip
"
in
filename
:
return
pandas
.
read_csv
(
path
)
else
:
return
from_postgres
(
filename
)
...
...
@@ -302,6 +302,7 @@ def dataframe_pondere(dictionnaire_simulations: Dict) -> pandas.DataFrame:
def
compare
(
period
:
str
,
dictionnaire_simulations
,
compute_deciles
=
True
):
logging
.
debug
(
"
Compare.
"
)
res
:
Total
=
{}
if
(
"
avant
"
not
in
dictionnaire_simulations
...
...
@@ -330,6 +331,7 @@ def compare(period: str, dictionnaire_simulations, compute_deciles=True):
).
sum
()
total
:
Total
=
res
if
compute_deciles
:
logging
.
debug
(
"
Calcule des déciles.
"
)
# On rajoute les simulations par défaut à la liste des colonnes sur lesquelles calculer les déciles,
# On en a besoin si ces colonnes ne sont pas déjà dans le dictionnaire_simulations (par exemple
# dans le cas d'un compare avec isdecile = True)
...
...
@@ -421,7 +423,7 @@ def adjustment_new(empiric: dict, annee: int, brute_result: dict):
"""
Facteur d
'
ajustement en fonction des valeurs par année présentent dans le PLF
"""
logging
.
debug
(
f
"
annee=
{
annee
}
empiric =
{
empiric
}
, brute_result=
{
brute_result
}
"
)
logging
.
debug
(
f
"
adjustment_new -
annee=
{
annee
}
empiric =
{
empiric
}
, brute_result=
{
brute_result
}
"
)
factor_avant
=
empiric
.
get
(
annee
)
/
brute_result
[
"
avant
"
]
if
brute_result
.
get
(
"
plf
"
):
factor_plf
=
empiric
.
get
(
str
(
int
(
annee
)
+
1
))
/
brute_result
[
"
plf
"
]
...
...
This diff is collapsed.
Click to expand it.
scripts/update_cache.py
+
2
−
2
View file @
d0745e28
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment