Open Ryclock opened 9 months ago
Thank you for the report!
Yes, I think this should instead use the data frame's .get()
method rather than getattr()
try_weightcol = adjlist.get(weight_col)
This should be a fairly straightforward fix.
I don't think it has been fixed yet.
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