We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 4be1ffa commit f483d6aCopy full SHA for f483d6a
pandas/core/reshape/tile.py
@@ -189,9 +189,9 @@ def cut(x, bins, right=True, labels=None, retbins=False, precision=3,
189
>>> pd.cut(array([0.1, 0.1, 0.2, 0.5, 0.5, 0.9, 1.0]),
190
... bins="auto")
191
... # doctest: +ELLIPSIS`
192
- [(0.0991, 0.325], (0.0991, 0.325], (0.0991, 0.325], (0.325, 0.55],
+ [(0.0991, 0.325], (0.0991, 0.325], (0.0991, 0.325], (0.325, 0.55],
193
(0.325, 0.55], (0.775, 1.0], (0.775, 1.0]]
194
- Categories (4, interval[float64]): [(0.0991, 0.325] < (0.325, 0.55] <
+ Categories (4, interval[float64]): [(0.0991, 0.325] < (0.325, 0.55] <
195
(0.55, 0.775] < (0.775, 1.0]]
196
"""
197
# NOTE: this binning code is changed a bit from histogram for var(x) == 0
@@ -207,7 +207,7 @@ def cut(x, bins, right=True, labels=None, retbins=False, precision=3,
207
if adj:
208
adj *= 0.001 # 0.1% of the range
209
else:
210
- adj = 0.001
+ adj = 0.001
211
if right:
212
bins[0] -= adj
213
pandas/tests/reshape/test_tile.py
@@ -40,20 +40,20 @@ def test_bins(self):
40
41
def test_str_bins(self):
42
data = np.array([0.1, 0.1, 0.2, 0.5, 0.5, 0.9, 1.0])
43
- result, bins_cut = cut(data, bins="auto",
44
- retbins=True)
45
-
+ result, bins_cut = cut(data, bins="auto",
+ retbins=True)
+
46
bins_np = np.histogram_bin_edges(data, "auto")
47
adj = (bins_np[-1] - bins_np[0]) * 0.001
48
bins_np[0] -= adj
49
tm.assert_almost_equal(bins_cut, bins_np)
50
- tm.assert_almost_equal(np.round(bins_cut, 4),
+ tm.assert_almost_equal(np.round(bins_cut, 4),
51
np.array([0.0991, 0.325, 0.55, 0.775, 1.0]))
52
53
- intervals = IntervalIndex.from_breaks(np.round(bins_np, 4),
+ intervals = IntervalIndex.from_breaks(np.round(bins_np, 4),
54
closed="right")
55
- expected = Categorical(intervals, ordered=True)
56
- tm.assert_index_equal(result.categories,
+ expected = Categorical(intervals, ordered=True)
+ tm.assert_index_equal(result.categories,
57
expected.categories)
58
59
def test_right(self):
0 commit comments