From 3f20779237e4d4f0025ee65cd66007dc42a522dd Mon Sep 17 00:00:00 2001 From: Jacob Wasserman Date: Fri, 5 Sep 2014 16:14:28 -0400 Subject: [PATCH] Use pd.notnull() not bool() bool(np.nan) evaluates to True. notnull() should be more of what we want here. --- geopandas/base.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/geopandas/base.py b/geopandas/base.py index 988c1af..5270d6e 100644 --- a/geopandas/base.py +++ b/geopandas/base.py @@ -6,6 +6,7 @@ from shapely.ops import cascaded_union, unary_union import shapely.affinity as affinity import numpy as np +import pandas as pd from pandas import Series, DataFrame, MultiIndex import geopandas as gpd @@ -70,7 +71,7 @@ class GeoPandasBase(object): else: stream = ((i, item.bounds, idx) for i, (idx, item) in enumerate(self.geometry.iteritems()) if - item and not item.is_empty) + pd.notnull(item) and not item.is_empty) try: self._sindex = SpatialIndex(stream) # What we really want here is an empty generator error, or