Skip to content

Commit 62d06bf

Browse files
authored
TST: Simplify test_interp_string_axis and test_qcut_binning_issues (#62470)
1 parent 522ba9b commit 62d06bf

File tree

2 files changed

+5
-18
lines changed

2 files changed

+5
-18
lines changed

pandas/tests/frame/methods/test_interpolate.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -366,7 +366,7 @@ def test_interp_time_inplace_axis(self):
366366
@pytest.mark.parametrize("axis_name, axis_number", [("index", 0), ("columns", 1)])
367367
def test_interp_string_axis(self, axis_name, axis_number):
368368
# https://github.com/pandas-dev/pandas/issues/25190
369-
x = np.linspace(0, 100, 1000)
369+
x = np.linspace(0, 100, 3)
370370
y = np.sin(x)
371371
df = DataFrame(
372372
data=np.tile(y, (10, 1)), index=np.arange(10), columns=x

pandas/tests/reshape/test_qcut.py

Lines changed: 4 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -101,23 +101,10 @@ def test_qcut_binning_issues(datapath):
101101
arr = np.loadtxt(cut_file)
102102
result = qcut(arr, 20)
103103

104-
starts = []
105-
ends = []
106-
107-
for lev in np.unique(result):
108-
s = lev.left
109-
e = lev.right
110-
assert s != e
111-
112-
starts.append(float(s))
113-
ends.append(float(e))
114-
115-
for (sp, sn), (ep, en) in zip(
116-
zip(starts[:-1], starts[1:]), zip(ends[:-1], ends[1:])
117-
):
118-
assert sp < sn
119-
assert ep < en
120-
assert ep <= sn
104+
starts = result.categories.left
105+
ends = result.categories.right
106+
assert (starts < ends).all()
107+
assert (starts[1:] <= ends[:-1]).all()
121108

122109

123110
def test_qcut_return_intervals():

0 commit comments

Comments
 (0)