Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
B
BSTIM Covid19 - Copy
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
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Jens Henrik Goebbert
BSTIM Covid19 - Copy
Commits
f7291b75
Commit
f7291b75
authored
4 years ago
by
Pascal
Browse files
Options
Downloads
Patches
Plain Diff
timedelta & check if map.csv exists
parent
2f3aec8b
Branches
Branches containing commit
No related tags found
No related merge requests found
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/add_rki_to_map.py
+6
-2
6 additions, 2 deletions
src/add_rki_to_map.py
with
6 additions
and
2 deletions
src/add_rki_to_map.py
+
6
−
2
View file @
f7291b75
...
@@ -15,8 +15,12 @@ dates = next(os.walk(figures))[1]
...
@@ -15,8 +15,12 @@ dates = next(os.walk(figures))[1]
# errors if the RKI based csv is out of date with the available folders
# errors if the RKI based csv is out of date with the available folders
for
date
in
dates
:
for
date
in
dates
:
map_csv_path
=
os
.
path
.
join
(
figures
,
date
,
'
map.csv
'
)
map_csv_path
=
os
.
path
.
join
(
figures
,
date
,
'
map.csv
'
)
if
not
os
.
path
.
exists
(
map_csv_path
):
continue
map_rki
=
data
.
loc
[
date
.
replace
(
'
_
'
,
'
-
'
)].
values
.
astype
(
'
float64
'
)
day_0
=
pd
.
Timestamp
(
date
.
replace
(
'
_
'
,
'
-
'
))
+
pd
.
Timedelta
(
days
=
26
)
map_rki
=
data
.
loc
[
day_0
].
values
.
astype
(
'
float64
'
)
for
(
i
,
(
key
,
_
))
in
enumerate
(
counties
.
items
()):
for
(
i
,
(
key
,
_
))
in
enumerate
(
counties
.
items
()):
n_people
=
counties
[
key
][
'
demographics
'
][(
'
total
'
,
2018
)]
n_people
=
counties
[
key
][
'
demographics
'
][(
'
total
'
,
2018
)]
map_rki
[
i
]
=
map_rki
[
i
]
/
n_people
*
100000
map_rki
[
i
]
=
map_rki
[
i
]
/
n_people
*
100000
...
@@ -24,4 +28,4 @@ for date in dates:
...
@@ -24,4 +28,4 @@ for date in dates:
map_data
=
pd
.
read_csv
(
map_csv_path
,
index_col
=
0
)
map_data
=
pd
.
read_csv
(
map_csv_path
,
index_col
=
0
)
map_data
[
"
newInf100k_RKI
"
]
=
list
(
map_rki
)
map_data
[
"
newInf100k_RKI
"
]
=
list
(
map_rki
)
map_data
.
to_csv
(
map_csv_path
)
#
map_data.to_csv(map_csv_path)
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