BUG: fix ndarray indexing with float in compat/scipy.py
State: closed

Fixes #5824, with a test to verify the DeprecationWarning is no longer raised.


Labels:
name: Numeric Operations
description: Arithmetic, Comparison, and Logical operations
name: Compat
description: pandas objects compatability with Numpy or Python functions

Comments:
looks good to me - thanks for the patch! this seems minor enough that it doesn't need a doc note - cool with that @jreback ?

@gdraps see my comments on the issue.

@gdraps did you see my comments?

Yes. Is the intent for all tests to compare against numpy.percentile, i.e.
remove hardcoded expects in pandas for this function? after only changing
test_quantile, i see two fails: test_timedelta_ops and
test_pass_args_kwargs.

# 

FAIL: test_timedelta_ops
(pandas.tseries.tests.test_timedeltas.TestTimedeltas)

---

Traceback (most recent call last):

  File
"/home/gmd/github_shadow/pandas/pandas/tseries/tests/test_timedeltas.py",
line 203, in test_timedelta_ops

```
tm.assert_almost_equal(result, expected)
```

  File "testing.pyx", line 58, in pandas._testing.assert_almost_equal
(pandas/src/testing.c:2561)

  File "testing.pyx", line 143, in pandas._testing.assert_almost_equal
(pandas/src/testing.c:2433)

AssertionError: numpy.timedelta64(2599999999,'ns') !=
numpy.timedelta64(2600000000,'ns')

# 

FAIL: test_pass_args_kwargs (pandas.tests.test_groupby.TestGroupBy)

---

Traceback (most recent call last):

  File "/home/gmd/github_shadow/pandas/pandas/tests/test_groupby.py", line
1911, in test_pass_args_kwargs

```
assert_frame_equal(agg_result, expected)
```

  File "/home/gmd/github_shadow/pandas/pandas/util/testing.py", line 566,
in assert_frame_equal

```
check_exact=check_exact)
```

  File "/home/gmd/github_shadow/pandas/pandas/util/testing.py", line 513,
in assert_series_equal

```
assert_almost_equal(left.values, right.values, check_less_precise)
```

  File "testing.pyx", line 58, in pandas._testing.assert_almost_equal
(pandas/src/testing.c:2561)

  File "testing.pyx", line 93, in pandas._testing.assert_almost_equal
(pandas/src/testing.c:1803)

  File "testing.pyx", line 140, in pandas._testing.assert_almost_equal
(pandas/src/testing.c:2394)

AssertionError: expected 0.91560 but got 0.93792

---

On Apr 4, 2014 3:46 PM, "jreback" notifications@github.com wrote:

> @gdraps https://github.com/gdraps did you see my comments?
> 
> ## 
> 
> Reply to this email directly or view it on GitHubhttps://github.com/pydata/pandas/pull/6740#issuecomment-39603701
> .

@gdraps I would be happy just dropping entirely pandas.compat.scipy/_quantile in favor of using the numpy method. Then just change the test_quantile test to compare against the numpy method iteself. (and just remove this part of the scipy dep).

Not sure why this was not done originally. Pls also add a test for using datetime64[ns] as I suspect this fails. (look at the isin method to see how to do this)

(comments from the issue)

no I think should entirely `pandas.compat.scipy/_quantile` no need to maintain it.

OK. Makes sense.
On Apr 4, 2014 4:11 PM, "jreback" notifications@github.com wrote:

> @gdraps https://github.com/gdraps I would be happy just dropping
> entirely pandas.compat.scipy/_quantile in favor of using the numpy method.
> Then just change the test_quantile test to compare against the numpy method
> iteself. (and just remove this part of the scipy dep).
> 
> Not sure why this was not done originally. Pls also add a test for using
> datetime64[ns] as I suspect this fails. (look at the isin method to see how
> to do this)
> 
> (comments from the issue)
> 
> no I think should entirely pandas.compat.scipy/_quantile no need to
> maintain it.
> 
> ## 
> 
> Reply to this email directly or view it on GitHubhttps://github.com/pydata/pandas/pull/6740#issuecomment-39606268
> .

this looks leftover as we merged #6810.