File tree Expand file tree Collapse file tree 1 file changed +8
-5
lines changed Expand file tree Collapse file tree 1 file changed +8
-5
lines changed Original file line number Diff line number Diff line change @@ -257,11 +257,14 @@ def to_adjlist(self,
257257 import pandas as pd
258258 except ImportError :
259259 raise ImportError ('pandas must be installed to use this method' )
260- adjlist = pd .DataFrame (((idx , n , w ) for idx , neighb in self
261- for n , w in list (neighb .items ())),
262- columns = ('focal' , 'neighbor' , 'weight' ))
263- return adjtools .filter_adjlist (
264- adjlist ) if remove_symmetric else adjlist
260+ n_islands = len (self .islands )
261+ if n_islands > 0 and (not self .silence_warnings ):
262+ warnings .warn ('{} islands in this weights matrix. Conversion to an '
263+ 'adjacency list will drop these observations!' )
264+ adjlist = pd .DataFrame (((idx , n ,w ) for idx , neighb in self
265+ for n ,w in list (neighb .items ())),
266+ columns = ('focal' , 'neighbor' , 'weight' ))
267+ return adjtools .filter_adjlist (adjlist ) if remove_symmetric else adjlist
265268
266269 def to_networkx (self ):
267270 """
You can’t perform that action at this time.
0 commit comments