BUG: Multiindexed series .at fix
State: closed

- [x] closes #26989
- [x] tests added / passed
- [x] passes `black pandas`
- [x] passes `git diff upstream/master -u -- "*.py" | flake8 --diff`
- [x] whatsnew entry


Labels:
name: Bug
name: Indexing
description: Related to indexing on series/frames, not to indexes themselves
name: MultiIndex

Comments:
The failure seems to be due to a numpy warning:

``
/home/runner/miniconda3/envs/pandas-dev/lib/python3.7/site-packages/numpy/core/include/numpy/npy_1_7_deprecated_api.h:17:2: warning: #warning "Using deprecated NumPy API, disable it with " "#define NPY_NO_DEPRECATED_API NPY_1_7_API_VERSION" [-Wcpp]
``

I don't understand why this is failing. Any suggestions or guidance is appreciated.
@jreback ping
> @jreback ping

Apologies, I thought it was green, but perhaps I was looking at on old tab. Looking into the failure now.
The failure appears unrelated to this PR. It is the warning

``
/home/runner/miniconda3/envs/pandas-dev/lib/python3.7/site-packages/numpy/core/include/numpy/npy_1_7_deprecated_api.h:17:2: warning: #warning "Using deprecated NumPy API, disable it with " "#define NPY_NO_DEPRECATED_API NPY_1_7_API_VERSION" [-Wcpp]
 #warning "Using deprecated NumPy API, disable it with " \
  ^~~~~~~
``
@rhshadrach can you rebase and ill take another look
Hello @rhshadrach! Thanks for updating this PR. We checked the lines you've touched for [PEP 8](https://www.python.org/dev/peps/pep-0008) issues, and found:





There are currently no PEP 8 issues detected in this Pull Request. Cheers! :beers: 

##### Comment last updated at 2020-05-18 20:00:11 UTC
@jbrockmendel I've rebased and all checks pass.
lgtm. can you merge master. cc @jbrockmendel merge when happy.
lgtm. cc @jbrockmendel merge when ready.
A few comments, generally looks very good
@jbrockmendel Thanks for the comments. I've addressed all of them. I believe failing checks are unrelated, but I'm having a hard time understanding the error messages.
LGTM.

Yes, the azure failure is unrelated.  To be on the safe side we usually try to sort these out before merging anything new.
> Seems to me #26989 does not address using .at when not all levels are specified. Perhaps you meant another issue?

It was not described in that issue, but this PR is still enabling it:

```
In [5]: s = pd.Series(range(4), index=pd.MultiIndex.from_product([['a', 'b'], [1, 2]]))    

In [6]: s  
Out[6]: 
a  1    0
   2    1
b  1    2
   2    3
dtype: int64

In [7]: s.at['a']    
Out[7]: 
1    0
2    1
dtype: int64
```

This fails on 0.25.3 and 1.0.3
Ah, but it seems this *also* already works on master, so it has been "accidentally" enabled due to some other refactoring, I suppose. So OK, indeed not directly related to your PR.
> Ah, but it seems this _also_ already works on master, so it has been "accidentally" enabled due to some other refactoring, I suppose. So OK, indeed not directly related to your PR.

With this, I think we should leave as-is in regards to non-scalar results. These can be fixed or documented and then tested for after discussion in #33153. I added the tests for DataFrame though. Note that DataFrame.loc fails with an Index of tuples, so I did not add this test.
@jorisvandenbossche changes made. Let me know if you agree with my assessment above.
@rhshadrach can you merge master. @jorisvandenbossche ok here?
@jorisvandenbossche Let me know if there are any more changes you'd like.
@rhshadrach can you rebase

I think this may make #32855 unnecessary
@jbrockmendel - done. Seems to me the only intersection with the PR you mentioned is the one test dealing with Series there. This PR only deals with Series, where as most of that is dealing with DataFrames.
@jorisvandenbossche @jreback I think this PR is all set.
@jreback Note added back, green
thanks @rhshadrach