# libpysal.weights.spw_from_gal

libpysal.weights.spw_from_gal(galfile)

  Sparse scipy matrix for w from a gal file.

  Parameters:
    galfile `python:str`

      name of gal file including suffix

  Returns:
    spw `sparse_matrix`

      scipy sparse matrix in CSR format

    ids `array`

      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