Skip to content

Commit

Permalink
left-inclusive divisions on _partition_of_index_value
Browse files Browse the repository at this point in the history
  • Loading branch information
mrocklin committed Jun 22, 2015
1 parent 161df08 commit 43afcab
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions dask/dataframe/core.py
Expand Up @@ -575,11 +575,11 @@ def _partition_of_index_value(divisions, val):
1
>>> _partition_of_index_value([0, 5, 10], 100)
1
>>> _partition_of_index_value([0, 5, 10], 5)
0
>>> _partition_of_index_value([0, 5, 10], 5) # left-inclusive divisions
1
"""
val = _coerce_loc_index(divisions, val)
i = bisect.bisect_left(divisions, val)
i = bisect.bisect_right(divisions, val)
return min(len(divisions) - 2, max(0, i - 1))


Expand Down

0 comments on commit 43afcab

Please sign in to comment.