Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion pandas/compat/scipy.py
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ def scoreatpercentile(a, per, limit=(), interpolation_method='fraction'):

idx = per / 100. * (values.shape[0] - 1)
if idx % 1 == 0:
score = values[idx]
score = values[int(idx)]
else:
if interpolation_method == 'fraction':
score = _interpolate(values[int(idx)], values[int(idx) + 1],
Expand Down
17 changes: 17 additions & 0 deletions pandas/tests/test_scipy.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
import numpy as np
import pandas as pd
from pandas.util.testing import assert_series_equal
import warnings

def test_describe_with_warnings_raised():
with warnings.catch_warnings():
# escalate warnings
warnings.simplefilter("error")
df = pd.DataFrame({"A": [1, 2, 3], "B": [1.2, 4.2, 5.2]})
act = df.groupby('A')['B'].describe().unstack(0)
exp = pd.Series(
[1.0, 1.2, np.NaN, 1.2, 1.2, 1.2, 1.2, 1.2],
['count', 'mean', 'std', 'min', '25%', '50%', '75%', 'max'],
)
assert_series_equal(act[1], exp)