libpysal.weights.spw_from_gal

libpysal.weights.spw_from_gal(galfile)[source]

Sparse scipy matrix for w from a gal file.

Parameters
galfilestr

name of gal file including suffix

Returns
spwsparse_matrix

scipy sparse matrix in CSR format

idsarray

identifiers for rows/cols of spw

Examples

>>> import libpysal
>>> spw = libpysal.weights.spw_from_gal(libpysal.examples.get_path("sids2.gal"))
>>> spw.sparse.nnz
462