libpysal.weights.spw_from_gal¶
-
libpysal.weights.
spw_from_gal
(galfile)[source]¶ Sparse scipy matrix for w from a gal file.
- Parameters
- galfile
python:str
name of gal file including suffix
- galfile
- Returns
- spw
sparse_matrix
scipy sparse matrix in CSR format
- ids
array
identifiers for rows/cols of spw
- spw
Examples
>>> import libpysal >>> spw = libpysal.weights.spw_from_gal(libpysal.examples.get_path("sids2.gal")) >>> spw.sparse.nnz 462