I need a help on trying to use the Hot Spot Analysis Plugin on QGIS Noosa. I am not able to install the module "moran".
moran is a part of
pysal package. So you can't install it using pip or something.
pysal changed the folder structure of the package. This is probably why you can't use the plugin or are getting errors. Hotspot Analysis plugin needs an update, but you follow such a temporary solution I explain below.
If you look at
hotspot_analysis.py file (QGIS 3 Plugins folder location), you will see the lines (line numbers may be different than yours. I skipped the indentation).
Line 39 from pysal.esda.getisord import * Line 40 from pysal.esda.moran import * Line 41 from pysal.weights.Distance import DistanceBand . Line 472 thresh = pysal.min_threshold_dist_from_shapefile(path) . Line 600 moran = pysal.Moran(y, w) . Line 608 w = pysal.knnW_from_shapefile(layerName.split("|"), k=weightValue, p=1) . Line 613 w = pysal.queen_from_shapefile(layerName.split("|"))
Change those lines into the lines below, respectively.
from pysal.explore.esda.getisord import * from pysal.explore.esda.moran import * from pysal.lib.weights import DistanceBand, Queen, KNN, user . thresh = user.min_threshold_dist_from_shapefile(path) . moran = Moran(y, w) . w = KNN.from_shapefile(layerName.split("|"), k=weightValue, p=1) . w = Queen.from_shapefile(layerName.split("|"))
Save the changes and re-activate the plugin or re-open QGIS.