FazBrowse GitHub Viewer
|
Trending
|
URL:
|
Home
Tools:
[Download Repo ZIP]
[View Raw Code]
[Original HTTPS Page]
activitysim/activitysim/examples/optimize_example_data.py at main · ActivitySim/activitysim · GitHub
Uh oh!
There was an error while loading.
Please reload this page
.
ActivitySim
/
activitysim
Public
Notifications
You must be signed in to change notification settings
Fork
135
Star
246
Code
Issues
177
Pull requests
9
Discussions
Actions
Projects
Wiki
Security and quality
0
Insights
Additional navigation options
Code
Issues
Pull requests
Discussions
Actions
Projects
Wiki
Security and quality
Insights
Expand file tree
Breadcrumbs
activitysim
/
activitysim
/
examples
/
optimize_example_data.py
Copy path
More file actions
More file actions
Latest commit
History
History
History
42 lines (32 loc) · 1.17 KB
Breadcrumbs
activitysim
/
activitysim
/
examples
/
optimize_example_data.py
Copy path
File metadata and controls
42 lines (32 loc) · 1.17 KB
Raw
Copy raw file
Download raw file
Open symbols panel
Edit and raw actions
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
from
__future__
import
annotations
import
os
import
openmatrix
import
pandas
as
pd
def
patch_example_sandag_1_zone
(
example_dir
):
cwd
=
os
.
getcwd
()
try
:
os
.
chdir
(
example_dir
)
skims
=
openmatrix
.
open_file
(
"data_1/skims1.omx"
,
mode
=
"a"
)
skims_lookup
=
skims
.
root
[
"lookup"
]
zone_name
=
None
if
len
(
skims_lookup
.
_v_children
)
==
1
:
zone_name
=
list
(
skims_lookup
.
_v_children
)[
0
]
zone_data
=
skims_lookup
[
zone_name
]
rezone
=
pd
.
Series
(
pd
.
RangeIndex
(
1
,
zone_data
.
shape
[
0
]
+
1
),
index
=
zone_data
[:],
)
else
:
rezone
=
None
if
rezone
is
not
None
:
households
=
pd
.
read_csv
(
"data_1/households.csv"
)
households
[
"TAZ"
]
=
households
[
"TAZ"
].
map
(
rezone
)
households
.
to_csv
(
"data_1/households.csv"
,
index
=
False
)
land_use
=
pd
.
read_csv
(
"data_1/land_use.csv"
)
land_use
[
"TAZ"
]
=
land_use
[
"TAZ"
].
map
(
rezone
)
land_use
.
to_csv
(
"data_1/land_use.csv"
,
index
=
False
)
if
zone_name
:
skims_lookup
[
zone_name
].
_f_remove
()
skims
.
close
()
finally
:
os
.
chdir
(
cwd
)
Back
|
FazBrowse Home
|
New Git URL