Applying max_colwidth to the DataFrame index (#7856)
closes #7856 

reports a problem with the application of max_colwidth to groupby.

The real problem is that max_colwidth is not applied to the index. This patch solves that.

I am not applying self.justify to the formatting of the index (as that would break a test). But maybe it makes more sense to change the test?

needs a test
 cc @bjonen @onesandzeroes
 I have added a test case. Tell me if you want anything changed, or if anything is missing. I will do a final squash when everything is up to standard.
 @jorisvandenbossche I now have time time to finalize this. I have merged with the current head. If there is still interest in dealing with this issue just say. I could imagine that there is still a few things to do (like adding an entry to whatsnew)...
 @tiagoantao Certainly interest!

Remark on the test: I don't think it is testing the correct thing (but you can also leave it in as it is now for testing the width of the columns), as it is testing the width of the columns which is already working. You can eg set some columns as the index, and then test again. That is what now is failing:

```
In [25]: pd.set_option('max_colwidth', 20)

In [26]: df
Out[26]: 
     a    b                    c  d
0  foo  bar  uncomfortably lo...  1
1  foo  bar                stuff  1

In [27]: df.set_index(['a', 'b', 'c'])  <-- failing in the index
Out[27]: 
                                                    d
a   b   c                                            
foo bar uncomfortably long line with lots of stuff  1
        stuff                                       1
```
 pls add a release note that explains this. if you can do this asap i can put in 0.16.0
 And the test needs an addition, see my comment above.
 I will do this over the weekend.

On 6 March 2015 at 09:21, Joris Van den Bossche notifications@github.com
wrote:

> And the test needs an addition, see my comment above.
> 
> ## 
> 
> Reply to this email directly or view it on GitHub
> https://github.com/pydata/pandas/pull/8954#issuecomment-77529226.

## 

When the senses are shaken, and the soul is driven to madness, Who can
stand? - William Blake
 I have tried to sort this out. My sincere apologies for the delay. I will be monitoring this during the next day or so. I will try to react as fast as possible if you find anything in need of intervention.
 Did all the corrections. I just hope the way I committed (i.e. in terms of logs and squash) is acceptable. My git-fu is a bit substandard.

I apologize for all these mistakes. I hope in the future, with this experience, I am able to do a few contributions will less noise.
 merged via https://github.com/pydata/pandas/commit/e4cb0f8a6cbb5f0c89b24783baa44326e4b2cccb

thanks!
