Skip to content

Commit 9f61964

Browse files
address comments
1 parent 1a77867 commit 9f61964

File tree

2 files changed

+9
-9
lines changed

2 files changed

+9
-9
lines changed

src/snowflake/snowpark/modin/plugin/utils/numpy_to_pandas.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -243,7 +243,7 @@ def percentile_mapper(
243243
Numpy np.percentile signature:
244244
Return the q-th percentile(s) of an array, Series, or DataFrame (a).
245245
246-
Pandas pd.unique signature:
246+
Pandas Series.quantile signature:
247247
Return the q-th quantile(s) of a Series or DataFrame.
248248
249249
Parameters
@@ -278,7 +278,7 @@ def percentile_mapper(
278278
if interpolation is not None:
279279
return NotImplemented
280280
input_values = a
281-
if isinstance(q, float):
281+
if isinstance(q, (float, int)):
282282
q = q / 100
283283
else:
284284
q = [percentage / 100 for percentage in q]

tests/integ/modin/test_numpy.py

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -165,19 +165,19 @@ def test_np_percentile(q):
165165
# Verify that numpy throws type errors when we return NotImplemented
166166
# when using optional parameters
167167
with pytest.raises(TypeError):
168-
np.percentile(y_true_snow_2d, axis=1)
168+
np.percentile(y_true_snow_2d, 50, axis=1)
169169
with pytest.raises(TypeError):
170-
np.percentile(y_true_snow_2d, out=np.zeros(1))
170+
np.percentile(y_true_snow_2d, 50, out=np.zeros(1))
171171
with pytest.raises(TypeError):
172-
np.percentile(y_true_snow_2d, overwrite_input=True)
172+
np.percentile(y_true_snow_2d, 50, overwrite_input=True)
173173
with pytest.raises(TypeError):
174-
np.percentile(y_true_snow_2d, method="inverted_cdf")
174+
np.percentile(y_true_snow_2d, 50, method="inverted_cdf")
175175
with pytest.raises(TypeError):
176-
np.percentile(y_true_snow_2d, keepdims=True)
176+
np.percentile(y_true_snow_2d, 50, keepdims=True)
177177
with pytest.raises(TypeError):
178-
np.percentile(y_true_snow_2d, weights=[0.25, 0.25, 0.25, 0.25])
178+
np.percentile(y_true_snow_2d, 50, weights=[0.25, 0.25, 0.25, 0.25])
179179
with pytest.raises(TypeError):
180-
np.percentile(y_true_snow_2d, interpolation="inverted_cdf")
180+
np.percentile(y_true_snow_2d, 50, interpolation="inverted_cdf")
181181

182182

183183
def test_logical_operators():

0 commit comments

Comments
 (0)