Skip to content

Commit b090f95

Browse files
committed
fix error handling for import error on pandas
1 parent 56c7b4f commit b090f95

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

libpysal/weights/weights.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -301,8 +301,10 @@ def to_adjlist(
301301
"""
302302
try:
303303
import pandas as pd
304-
except ImportError:
305-
raise ImportError("pandas must be installed to use this method")
304+
except (ImportError, ModuleNotFoundError):
305+
raise ImportError(
306+
"pandas must be installed & importable to use this method"
307+
)
306308
n_islands = len(self.islands)
307309
if n_islands > 0 and (not self.silence_warnings):
308310
warnings.warn(

0 commit comments

Comments
 (0)