Last active
May 6, 2021 06:40
-
-
Save lmeulen/99d35a1816edc55a55a8331a3483454d to your computer and use it in GitHub Desktop.
traveltime_unreachables
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Unreachable? Closest other postal area and add 15 min | |
for index, pcode in pc.iterrows(): | |
if math.isnan(pcode.Traveltime): | |
# get 'not disjoint' countries | |
dst=pc[pc.geometry.touches(pcode.geometry)]['Traveltime'].mean(skipna=True) | |
# add names of neighbors as NEIGHBORS value | |
if ~math.isnan(dst) and (dst > 0): | |
pc.at[index, "Traveltime"] = int(dst + 15) | |
else: | |
pc.at[index, "Traveltime"] = pc.Traveltime.max() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment