Error at groupby using apply ValueError: No axis named 1 for object type <class 'pandas.core.series.Series'>
I was working to perform a groupby apply operation by using pandas. I used the following code:

```python
import pandas as pd
import numpy as np

my_df = pd.DataFrame({'DOG#3M': {'1/1/1999': 0.04825, '1/4/1999': 0.0476, '1/5/1999': 0.0474, '1/6/1999': 0.0476, '1/7/1999': 0.0474},
 'DOG#6M': {'1/1/1999': 0.04751, '1/4/1999': 0.0469, '1/5/1999': 0.0471, '1/6/1999': 0.0473, '1/7/1999': 0.0468,},
 'CAT#3M': {'1/1/1999': 0.05072, '1/4/1999': 0.0501, '1/5/1999': 0.0501, '1/6/1999': 0.0498, '1/7/1999': 0.0497,},
 'FISH#3M': {'1/1/1999': np.nan, '1/4/1999': 0.0161, '1/5/1999': 0.0155, '1/6/1999': 0.01495, '1/7/1999': 0.015, },
 'FISH#6M': {'1/1/1999': 0.0323, '1/4/1999': 0.03223, '1/5/1999': 0.03204, '1/6/1999': 0.03197, '1/7/1999': 0.03179,}})
 
result = my_df.groupby(by=lambda c: c.split('#')[0], axis='columns').apply(
    lambda df:
    pd.DataFrame(df.values, index=df.index,
                     columns=[c.split('#', )[-1] for c in df.columns]).stack()
)
```
#### Problem description
I tested under Python 2.7 and Python 3.5 pandas version (0.17.1 and 0.18.1) but only on pandas 0.17.1

- Python 2.7 Pandas 0.17.1 Passed
- Python 2.7 Pandas 0.18.1 Failed
- Python 3.5 Pandas 0.17.1 Passed
- Python 3.5 Pandas 0.18.1 Failed
- Python 3.5 Pandas 0.23.4 Failed




 I was able to get a result. On Pandas >=0.18.1 I got this error:
`ValueError: No axis named 1 for object type <class 'pandas.core.series.Series'>`

input dataframe:

![image](https://user-images.githubusercontent.com/20059518/49887982-6fde5980-fe03-11e8-8653-cfdacd7848b9.png)


I expect something like this:
![image](https://user-images.githubusercontent.com/20059518/49895910-6b23a080-fe17-11e8-88d3-b884d7d676e8.png)




