# libpysal.weights.WSP2W

libpysal.weights.WSP2W(wsp, **kwargs)

  Convert a pysal WSP object (thin weights matrix) to a pysal W object.

  Parameters:
    wsp `WSP`

      PySAL sparse weights object

    **kwargs `keyword` `arguments`

      optional arguments for `pysal.weights.W`

  Returns:
    w `W`

      PySAL weights object

  Examples

      >>> from libpysal.weights import lat2W, WSP, WSP2W

  Build a 10x10 scipy.sparse matrix for a rectangular 2x5 region of cells (rook contiguity), then construct a PySAL sparse weights object (wsp).

      >>> sp = lat2SW(2, 5)
      >>> wsp = WSP(sp)
      >>> wsp.n
      10
      >>> wsp.sparse[0].todense()
      matrix([[0, 1, 0, 0, 0, 1, 0, 0, 0, 0]], dtype=int8)

  Convert this sparse weights object to a standard PySAL weights object.

      >>> w = WSP2W(wsp)
      >>> w.n
      10
      >>> print(w.full()[0][0])
      [0. 1. 0. 0. 0. 1. 0. 0. 0. 0.]