Skip to content

Commit 2db0c7a

Browse files
committed
BUG: pandas.cut and negative values #14652
Fix issue #14652
1 parent 3f523f3 commit 2db0c7a

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

pandas/tools/tile.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -98,8 +98,8 @@ def cut(x, bins, right=True, labels=None, retbins=False, precision=3,
9898
mn, mx = [mi + 0.0 for mi in rng]
9999

100100
if mn == mx: # adjust end points before binning
101-
mn -= .001 * mn
102-
mx += .001 * mx
101+
mn -= .001 * abs(mn)
102+
mx += .001 * abs(mx)
103103
bins = np.linspace(mn, mx, bins + 1, endpoint=True)
104104
else: # adjust end points after binning
105105
bins = np.linspace(mn, mx, bins + 1, endpoint=True)

0 commit comments

Comments
 (0)