pysal / mgwr

Multiscale Geographically Weighted Regression (MGWR)
https://mgwr.readthedocs.io/
BSD 3-Clause "New" or "Revised" License
368 stars 126 forks source link

How to solve the problem about the "invalid index to scalar variable" when use Sel_BW.search( ) ? #143

Closed HeyAy closed 9 months ago

HeyAy commented 9 months ago

I use the function "Sel_BW ()", it can run successfully. But when i use the Sel_BW.search( ), python warns that "IndexError: invalid index to scalar variable."

HeyAy commented 9 months ago

Well, i solve the above problem with reshaping the np.array on the y variable.

Ziqi-Li commented 9 months ago

Ok great, I am closing this comment.

T-QFL commented 7 months ago

Ahhhhhhhh! Finally!

WilsonZrB commented 2 weeks ago

sorry, I came occur to this problem , but I dont know my XY is good or not:

X_scaled shape: (22748, 8) y shape: (22748,) coords shape: (22748, 2) X_scaled dtype: float64 y dtype: float64 coords dtype: float64

above are my output of my xy shape and datatype

marquisvictor commented 2 weeks ago

I don't know if this is too late but the shape of your dependent variable (y) should be (n, 1) matrix. I would do a reshape on the y to make it a two-dimensional column matrix. Hope that helps