File tree 1 file changed +3
-10
lines changed
1 file changed +3
-10
lines changed Original file line number Diff line number Diff line change 4
4
import numpy as np
5
5
6
6
from pandas ._libs import Timedelta , Timestamp
7
- from pandas ._libs .interval import Interval
8
7
from pandas ._libs .lib import infer_dtype
9
8
10
9
from pandas .core .dtypes .common import (
@@ -516,17 +515,11 @@ def _format_labels(
516
515
adjust = lambda x : x - 10 ** (- precision )
517
516
518
517
breaks = [formatter (b ) for b in bins ]
519
- labels = IntervalIndex .from_breaks (breaks , closed = closed )
520
-
521
518
if right and include_lowest :
522
- # we will adjust the left hand side by precision to
523
- # account that we are all right closed
524
- v = adjust (labels [0 ].left )
525
-
526
- i = IntervalIndex ([Interval (v , labels [0 ].right , closed = "right" )])
527
- labels = i .append (labels [1 :])
519
+ # adjust lhs of first interval by precision to account for being right closed
520
+ breaks [0 ] = adjust (breaks [0 ])
528
521
529
- return labels
522
+ return IntervalIndex . from_breaks ( breaks , closed = closed )
530
523
531
524
532
525
def _preprocess_for_cut (x ):
You can’t perform that action at this time.
0 commit comments