improves groupby.get_group_index when shape is a long sequence
closes #10161 

xref https://github.com/pydata/pandas/issues/10161#issuecomment-142701582

``` python
In [5]: df = DataFrame(np.random.randn(5000, 100).astype(str))

In [6]: %timeit df.duplicated()
1 loops, best of 3: 151 ms per loop

In [7]: %timeit df.T.duplicated()
1 loops, best of 3: 1.39 s per loop
```

part of this is because of taking the transpose (maybe cache locality). i.e. below performs better even though the shape is the same as `df.T` in above:

``` python
In [8]: df = DataFrame(np.random.randn(100, 5000).astype(str))

In [9]: %timeit df.duplicated()
1 loops, best of 3: 965 ms per loop
```
