Skip to content

Commit

Permalink
fixed nearest street test
Browse files Browse the repository at this point in the history
  • Loading branch information
u3ks committed Jun 20, 2024
1 parent 8794f5c commit 0609c66
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
3 changes: 2 additions & 1 deletion momepy/functional/_elements.py
Original file line number Diff line number Diff line change
Expand Up @@ -465,7 +465,8 @@ def get_nearest_street(
ids = np.empty(len(buildings), dtype=np.float32)
ids[:] = np.nan

ids[blg_idx] = streets.index[str_idx]
ids = pd.Series(np.nan, index=buildings.index)
ids.iloc[blg_idx] = streets.index[str_idx]
return ids


Expand Down
2 changes: 1 addition & 1 deletion momepy/functional/tests/test_elements.py
Original file line number Diff line number Diff line change
Expand Up @@ -222,7 +222,7 @@ def test_get_nearest_street(self):

streets.index = streets.index.astype(str)
nearest = mm.get_nearest_street(self.df_buildings, streets, 10)
assert (nearest == None).sum() == 137 # noqa: E711
assert pd.isna(nearest).sum() == 137 # noqa: E711

def test_get_nearest_node(self):
nodes, edges = mm.nx_to_gdf(mm.gdf_to_nx(self.df_streets))
Expand Down

0 comments on commit 0609c66

Please sign in to comment.