libpysal.weights.full¶
- libpysal.weights.full(w)[source]¶
Generate a full numpy array.
- Parameters:
- w
W
spatial weights object
- w
- Returns:
- (fullw, keys)
tuple
first element being the full numpy array and second element keys being the ids associated with each row in the array.
- (fullw, keys)
Examples
>>> from libpysal.weights import W, full >>> neighbors = {'first':['second'],'second':['first','third'],'third':['second']} >>> weights = {'first':[1],'second':[1,1],'third':[1]} >>> w = W(neighbors, weights) >>> wf, ids = full(w) >>> wf array([[0., 1., 0.], [1., 0., 1.], [0., 1., 0.]]) >>> ids ['first', 'second', 'third']