-
Notifications
You must be signed in to change notification settings - Fork 78
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
try_weightcol is incorrectly defined using getattr() #669
Comments
Thank you for the report! Yes, I think this should instead use the data frame's try_weightcol = adjlist.get(weight_col) This should be a fairly straightforward fix. |
ljwolf
changed the title
useless code of try_weightcol
try_weightcol is incorrectly defined using getattr()
Dec 20, 2023
I don't think it has been fixed yet. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Question Description
In line 372 of the libpysal/weights/weights.py file, the
getattr
function is called to assign a value totry_weightcol
. However, since the third parameter ofgetattr
(the default value to be returned when the attribute is not found) is not passed, it will result in anAttributeError: 'DataFrame' object has no attribute 'weight'
if the 'weight_col' column is not present in the 'adjlist', and this will terminate the program.So, when will the code at lines 373-375 be executed?
Essential Information
The text was updated successfully, but these errors were encountered: