Skip to content

Removing internal use of id_order in to_adjlist #510

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jan 16, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 1 addition & 4 deletions libpysal/weights/weights.py
Original file line number Diff line number Diff line change
Expand Up @@ -432,12 +432,9 @@ def to_adjlist(

links = []
focal_ix, neighbor_ix = self.sparse.nonzero()
names = np.asarray(self.id_order)
focal = names[focal_ix]
neighbor = names[neighbor_ix]
weights = self.sparse.data
adjlist = pandas.DataFrame(
{focal_col: focal, neighbor_col: neighbor, weight_col: weights}
{focal_col: focal_ix, neighbor_col: neighbor_ix, weight_col: weights}
)
if remove_symmetric:
adjlist = adjtools.filter_adjlist(adjlist)
Expand Down