DOC: fix Series.reset_index example
State: closed

- [ ] closes #xxxx
- [ ] tests added / passed
- [ ] passes `git diff upstream/master -u -- "*.py" | flake8 --diff`
- [ ] whatsnew entry

Show correct values in idx column.

Labels:
name: Docs

Comments:
Thanks! Do you have any interest in updating the example right below that in the docstring so that the doctest passes? `pytest --doctest-modules pandas/core/series.py  -k reset_index` currently fails since we use random numbers for the next one. I think if you did `s2 = pd.Series(range(8),  index=...)` and updated the example, things should pass.
Sure, I'll make the change.
# [Codecov](https://codecov.io/gh/pandas-dev/pandas/pull/19930?src=pr&el=h1) Report
> Merging [#19930](https://codecov.io/gh/pandas-dev/pandas/pull/19930?src=pr&el=desc) into [master](https://codecov.io/gh/pandas-dev/pandas/commit/f4c9d966fb20d9ca3221d31bd9eb31117065808c?src=pr&el=desc) will **not change** coverage.
> The diff coverage is `n/a`.

[![Impacted file tree graph](https://codecov.io/gh/pandas-dev/pandas/pull/19930/graphs/tree.svg?width=650&height=150&src=pr&token=eZ4WkYLtcO)](https://codecov.io/gh/pandas-dev/pandas/pull/19930?src=pr&el=tree)

```diff
@@           Coverage Diff           @@
##           master   #19930   +/-   ##
=======================================
  Coverage   91.66%   91.66%           
=======================================
  Files         150      150           
  Lines       48974    48974           
=======================================
  Hits        44894    44894           
  Misses       4080     4080
```

| Flag | Coverage Δ | |
|---|---|---|
| #multiple | `90.04% <ø> (ø)` | :arrow_up: |
| #single | `41.85% <ø> (ø)` | :arrow_up: |

| [Impacted Files](https://codecov.io/gh/pandas-dev/pandas/pull/19930?src=pr&el=tree) | Coverage Δ | |
|---|---|---|
| [pandas/core/series.py](https://codecov.io/gh/pandas-dev/pandas/pull/19930/diff?src=pr&el=tree#diff-cGFuZGFzL2NvcmUvc2VyaWVzLnB5) | `94.24% <ø> (ø)` | :arrow_up: |

------

[Continue to review full report at Codecov](https://codecov.io/gh/pandas-dev/pandas/pull/19930?src=pr&el=continue).
> **Legend** - [Click here to learn more](https://docs.codecov.io/docs/codecov-delta)
> `Δ = absolute <relative> (impact)`, `ø = not affected`, `? = missing data`
> Powered by [Codecov](https://codecov.io/gh/pandas-dev/pandas/pull/19930?src=pr&el=footer). Last update [f4c9d96...777f549](https://codecov.io/gh/pandas-dev/pandas/pull/19930?src=pr&el=lastupdated). Read the [comment docs](https://docs.codecov.io/docs/pull-request-comments).

Not sure if I'm missing a doctest gotcha here, but locally I still get the following test failure. Probably a simple fix but I don't see it - both lines look the same to me, including wrt whitespace.

`$ pytest --doctest-modules pandas/core/series.py -k reset_index`

```
============================================== FAILURES ===============================================
___________________________ [doctest] pandas.core.series.Series.reset_index ___________________________
1029
1030         >>> arrays = [np.array(['bar', 'bar', 'baz', 'baz', 'foo',
1031         ...                     'foo', 'qux', 'qux']),
1032         ...           np.array(['one', 'two', 'one', 'two', 'one', 'two',
1033         ...                     'one', 'two'])]
1034         >>> s2 = pd.Series(
1035         ...     range(8),
1036         ...     index=pd.MultiIndex.from_arrays(arrays,
1037         ...                                     names=['a', 'b']))
1038         >>> s2.reset_index(level='a')
Differences (unified diff with -expected +actual):
    @@ -1,4 +1,4 @@
            a  0
    -b
    +b
     one  bar  0
     two  bar  1

/Users/philngo/dev/pandas-philngo/pandas/core/series.py:1038: DocTestFailure
========================================= 24 tests deselected =========================================
=============================== 1 failed, 24 deselected in 0.04 seconds ===============================
```
That is indeed a doctest gotcha. I think it's wanting some whitespace after the `b` and below the column names. Added https://github.com/pandas-dev/pandas/issues/19934 to talk about how to handle that.

This looks good to me. Will merge once appveyor is finished (let us know if you see that it's done).
Great, thanks! @TomAugspurger Looks like appveyor finished.
@philngo Thanks a lot!