CLN: Use apply() rather than str to get len of each element

This commit is contained in:
Kelsey Jordahl
2015-04-28 22:08:08 -07:00
parent a266da5ed6
commit e6251da159
+1 -1
View File
@@ -52,7 +52,7 @@ def sjoin(left_df, right_df, how='inner', op='intersects',
# FIND INTERSECTION OF SPATIAL INDEX
idxmatch = (left_df['geometry'].apply(lambda x: x.bounds)
.apply(lambda x: list(tree_idx.intersection(x))))
idxmatch = idxmatch[idxmatch.str.len() > 0]
idxmatch = idxmatch[idxmatch.apply(len) > 0]
r_idx = np.concatenate(idxmatch.values)
l_idx = np.concatenate([[i] * len(v) for i, v in idxmatch.iteritems()])