Skip to content

Commit

Permalink
BUG: fix extraction of ids if there is only a single hit
Browse files Browse the repository at this point in the history
  • Loading branch information
martinfleis committed Nov 26, 2024
1 parent 4550d91 commit 23037c6
Showing 1 changed file with 12 additions and 4 deletions.
16 changes: 12 additions & 4 deletions momepy/streetscape.py
Original file line number Diff line number Diff line change
Expand Up @@ -2115,10 +2115,10 @@ def point_level(self) -> gpd.GeoDataFrame:

point_data = point_data.explode(point_data.columns.tolist())
point_data["left_ids"] = point_data["left_ids"].apply(
lambda x: {c for c in x if not pd.isna(c)}
lambda x: {c for c in x if not pd.isna(c)} if isinstance(x, list) else {x}
)
point_data["right_ids"] = point_data["right_ids"].apply(
lambda x: {c for c in x if not pd.isna(c)}
lambda x: {c for c in x if not pd.isna(c)} if isinstance(x, list) else {x}
)
point_data = point_data.rename(
columns={"left_ids": "left_seq_sb_index", "right_ids": "right_seq_sb_index"}
Expand Down Expand Up @@ -2212,10 +2212,18 @@ def point_level(self) -> gpd.GeoDataFrame:

point_data["left_plot_seq_sb_index"] = point_data[
"left_plot_seq_sb_index"
].apply(lambda x: {c for c in x if not pd.isna(c)})
].apply(
lambda x: {c for c in x if not pd.isna(c)}
if isinstance(x, list)
else {x}
)
point_data["right_plot_seq_sb_index"] = point_data[
"right_plot_seq_sb_index"
].apply(lambda x: {c for c in x if not pd.isna(c)})
].apply(
lambda x: {c for c in x if not pd.isna(c)}
if isinstance(x, list)
else {x}
)
inds.extend(
[
"plot_seq_sb",
Expand Down

0 comments on commit 23037c6

Please sign in to comment.