Skip to content

Commit 4200397

Browse files
COMPAT: use numpy searchsorted
Because it is not needed + to overcome pandas API change in 0.24.0 to return scalar instead of 1-element array
1 parent cb7a4a0 commit 4200397

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

contextily/tile.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -260,13 +260,13 @@ def bb2wdw(bb, rtr):
260260
((row_start, row_stop), (col_start, col_stop))
261261
'''
262262
rbb = rtr.bounds
263-
xi = pd.Series(np.linspace(rbb.left, rbb.right, rtr.shape[1]))
264-
yi = pd.Series(np.linspace(rbb.bottom, rbb.top, rtr.shape[0]))
263+
xi = np.linspace(rbb.left, rbb.right, rtr.shape[1])
264+
yi = np.linspace(rbb.bottom, rbb.top, rtr.shape[0])
265265

266-
window = ((rtr.shape[0] - yi.searchsorted(bb[3])[0],
267-
rtr.shape[0] - yi.searchsorted(bb[1])[0]),
268-
(xi.searchsorted(bb[0])[0],
269-
xi.searchsorted(bb[2])[0])
266+
window = ((rtr.shape[0] - yi.searchsorted(bb[3]),
267+
rtr.shape[0] - yi.searchsorted(bb[1])),
268+
(xi.searchsorted(bb[0]),
269+
xi.searchsorted(bb[2]))
270270
)
271271
return window
272272

0 commit comments

Comments
 (0)