DOC: add examples to set_index method
State: closed

 - [x] related to #16416 
 - [x] tests added / passed
 - [x] passes ``git diff upstream/master --name-only -- '*.py' | flake8 --diff``
 - [ ] whatsnew entry

Added better examples in the doc for the dataframe set_index() method.

Labels:
name: Docs

Comments:
@TomAugspurger @jorisvandenbossche hey, I've just submitted a PR adding a couple of examples to dataframe set_index()
# [Codecov](https://codecov.io/gh/pandas-dev/pandas/pull/16467?src=pr&el=h1) Report
> Merging [#16467](https://codecov.io/gh/pandas-dev/pandas/pull/16467?src=pr&el=desc) into [master](https://codecov.io/gh/pandas-dev/pandas/commit/04356a83c0dc8a749c84e168535e6673f2548ec6?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/16467/graphs/tree.svg?height=150&width=650&token=eZ4WkYLtcO&src=pr)](https://codecov.io/gh/pandas-dev/pandas/pull/16467?src=pr&el=tree)

```diff
@@           Coverage Diff           @@
##           master   #16467   +/-   ##
=======================================
  Coverage   90.42%   90.42%           
=======================================
  Files         161      161           
  Lines       51027    51027           
=======================================
  Hits        46142    46142           
  Misses       4885     4885
```

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

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

------

[Continue to review full report at Codecov](https://codecov.io/gh/pandas-dev/pandas/pull/16467?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/16467?src=pr&el=footer). Last update [04356a8...29503fb](https://codecov.io/gh/pandas-dev/pandas/pull/16467?src=pr&el=lastupdated). Read the [comment docs](https://docs.codecov.io/docs/pull-request-comments).

# [Codecov](https://codecov.io/gh/pandas-dev/pandas/pull/16467?src=pr&el=h1) Report
> Merging [#16467](https://codecov.io/gh/pandas-dev/pandas/pull/16467?src=pr&el=desc) into [master](https://codecov.io/gh/pandas-dev/pandas/commit/97ad3fb9c87226ad983267e2891dbbf68432b8ea?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/16467/graphs/tree.svg?height=150&token=eZ4WkYLtcO&src=pr&width=650)](https://codecov.io/gh/pandas-dev/pandas/pull/16467?src=pr&el=tree)

```diff
@@           Coverage Diff           @@
##           master   #16467   +/-   ##
=======================================
  Coverage    90.4%    90.4%           
=======================================
  Files         161      161           
  Lines       51033    51033           
=======================================
  Hits        46136    46136           
  Misses       4897     4897
```

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

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

------

[Continue to review full report at Codecov](https://codecov.io/gh/pandas-dev/pandas/pull/16467?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/16467?src=pr&el=footer). Last update [97ad3fb...71c5b18](https://codecov.io/gh/pandas-dev/pandas/pull/16467?src=pr&el=lastupdated). Read the [comment docs](https://docs.codecov.io/docs/pull-request-comments).

lgtm. @TomAugspurger not sure if you had any comments.
Thanks @geoninja!
Thank you, @TomAugspurger ! I'm also going to work on reset_values() so we can close #16416.