Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
B
benb_utils
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
This is an archived project. Repository and other project resources are read-only.
Show more breadcrumbs
Roelofsen, Hans
benb_utils
Commits
8c0d57ea
Commit
8c0d57ea
authored
2 years ago
by
Roelofsen, Hans
Browse files
Options
Downloads
Plain Diff
Merge branch 'working_20230228' into 'master'
corresponding update to class See merge request
!14
parents
d1485756
753c71cf
Branches
Branches containing commit
No related tags found
1 merge request
!14
corresponding update to class
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
snl_beheertypen.py
+12
-8
12 additions, 8 deletions
snl_beheertypen.py
with
12 additions
and
8 deletions
snl_beheertypen.py
+
12
−
8
View file @
8c0d57ea
...
...
@@ -17,24 +17,28 @@ filepath = pathlib.Path(__file__)
benb_dir
=
os
.
path
.
dirname
(
filepath
)
csv_file
=
os
.
path
.
join
(
benb_dir
,
'
resources/snl_beheertypen.csv
'
)
def
get_snl_beheertypen_list
(
csv_target
=
csv_file
,
of
=
'
sparse
'
):
def
get_snl_beheertypen_list
(
of
=
'
sparse
'
):
"""
return snl beheertypen list as pandas df
:param benb_dir: directory of benb_utils
:return: pandas dataframe
"""
csv_target
=
os
.
path
.
join
(
pathlib
.
Path
(
__file__
).
parents
[
0
],
'
resources
'
,
'
snl_beheertypen.csv
'
)
df
=
pd
.
read_csv
(
csv_target
,
sep
=
'
,
'
,
comment
=
'
#
'
,
quotechar
=
'"'
)
mnp_codes
=
df
.
LAND_TYPE_CODE
.
apply
(
fbt
.
fix_bt
,
as_mnp
=
True
)
mnp_codes
=
df
.
land_type_code
.
apply
(
fbt
.
fix_bt
,
as_mnp
=
True
)
return
{
'
full
'
:
df
.
assign
(
mnp_code
=
mnp_codes
),
'
sparse
'
:
df
}[
of
]
df
=
pd
.
read_csv
(
csv_file
,
sep
=
'
,
'
,
comment
=
'
#
'
,
quotechar
=
'"'
)
code2name
=
dict
(
zip
(
df
.
LAND_TYPE_CODE
.
apply
(
fbt
.
fix_bt
,
as_mnp
=
True
),
df
.
LST_NAME
))
code2name
=
dict
(
zip
(
df
.
land_type_code
.
apply
(
fbt
.
fix_bt
,
as_mnp
=
True
),
df
.
land_type_name
))
code2code_name
=
dict
(
zip
(
df
.
LAND_TYPE_CODE
.
apply
(
fbt
.
fix_bt
,
as_mnp
=
True
),
df
.
LST_CODE_NAME
))
code2code_name
=
dict
(
zip
(
df
.
land_type_code
.
apply
(
fbt
.
fix_bt
,
as_mnp
=
True
),
df
.
land_type_code_name
))
# TODO: hier moet eigenlijk een functie komen als:
# def code2anythin(code)
...
...
@@ -47,8 +51,8 @@ code2code_name = dict(zip(df.LAND_TYPE_CODE.apply(fbt.fix_bt, as_mnp=True),
def
btcode2description
(
code
):
# Note: dit hoeft niet perse in een functie te staan.
try
:
return
dict
(
zip
(
df
.
LAND_TYPE_CODE
.
apply
(
fbt
.
fix_bt
,
as_mnp
=
True
),
df
.
LST_NAME
))[
fbt
.
fix_bt
(
code
,
as_mnp
=
True
)]
return
dict
(
zip
(
df
.
land_type_code
.
apply
(
fbt
.
fix_bt
,
as_mnp
=
True
),
df
.
land_type_name
))[
fbt
.
fix_bt
(
code
,
as_mnp
=
True
)]
except
KeyError
as
e
:
print
(
'
\n
{} is not a valid beheertype
\n
'
.
format
(
code
))
sys
.
exit
(
0
)
...
...
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