ENH: `Styler.format_index()` to display index values similarly to data-values with `format()`
State: closed

- [x] adds features and method with docstrings
- [x] update user guide
- [x] whats new
- [x] add tests

This PR adds the method `format_index` so that the typical `format` routines can also be applied to display the index labels and columns headers of a Styler.

With all the recent functionality here is a complete example:


![Screen Shot 2021-08-18 at 22 55 02](https://user-images.githubusercontent.com/24256554/129970916-0092bd76-f322-4b5f-87b4-1276ac2d303e.png)



**Notes**

Also had to move `_refactor_levels` function from `style.py` to `style_render.py` for use here.


Labels:
name: Styler
description: conditional formatting using DataFrame.style

Comments:
hmm why do we want to add methods like this? e.g. if you want to string format an index you can already
 - Styler displays values without altering the underlying DataFrame. Using `pd.Index.format` returns a formatted Index which you *need to overwrite* as the DataFrames Index prior to calling Styler, therefore it breaks the typical usage pattern.
 - `pd.Index.format` does not have the additional options available in `format_index` like HTML/LaTeX escaping, and has a different signature to `Styler.format` which might confuse users.
 - Needing to overwrite the Index with your display format means you can lose functionality of indexing. Here is an example of how this helps preserve functionality:

![Screen Shot 2021-08-20 at 09 01 21](https://user-images.githubusercontent.com/24256554/130193536-1ede994d-4b15-4203-ab2f-c69c18942ec6.png)


 Do throw this out to the team for feedback...
**User Guide Updates:**

![Screen Shot 2021-08-31 at 13 02 29](https://user-images.githubusercontent.com/24256554/131491743-11755a14-cb6c-4a41-8416-241b823189c0.png)


these tests consistently fail running the ipython in `source/user_guide/scale.rst` dealing with dask DataFrame. 
But this PR is unrelated to that so I don't know the reason. Couldn't really find other PRs suffering from the same test failures?
The docs build locally without errors so its puzzling.
> these tests consistently fail running the ipython in `source/user_guide/scale.rst` dealing with dask DataFrame.
> But this PR is unrelated to that so I don't know the reason. Couldn't really find other PRs suffering from the same test failures?
> The docs build locally without errors so its puzzling.

hmm, did dask version change?
looks like some actual doc failures: https://github.com/pandas-dev/pandas/pull/43101/checks?check_run_id=3570623205
> looks like some actual doc failures: https://github.com/pandas-dev/pandas/pull/43101/checks?check_run_id=3570623205

everytime says `build completed with 8 warnings`, and every warning is in respect to `/home/runner/work/pandas/pandas/doc/source/user_guide/scale.rst`, which is an unaltered file, and never calls Styler or the impacted files here.

The docs build locally without warning so I am puzzled, will see if I can come up with anything
@jreback managed to get this to pass after merge. revert if necessary but I think should be ok now.
ok great. very odd that that was happening,