BUG: Empty PeriodIndex issues
- [x] closes #13067 (existing PR)
- [x] tests added / passed
- [X] passes `git diff upstream/master | flake8 --diff`
- [x] whatsnew entry

closes #13067
 closes #13212

@jreback @sinhrks:
Any idea what this might be? It only happens on 2.7 and so I would need to rebuild to step through. No prob if nothing comes to mind though:

``` python
======================================================================
ERROR: test_resample_empty (pandas.tseries.tests.test_resample.TestPeriodIndex)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/home/travis/build/pydata/pandas/pandas/tseries/tests/test_resample.py", line 2054, in test_resample_empty
    result = getattr(s.resample(freq), method)()
  File "/home/travis/build/pydata/pandas/pandas/tseries/resample.py", line 511, in f
    return self._downsample(_method)
  File "/home/travis/build/pydata/pandas/pandas/tseries/resample.py", line 805, in _downsample
    return self._groupby_and_aggregate(how, grouper=grouper)
  File "/home/travis/build/pydata/pandas/pandas/tseries/resample.py", line 379, in _groupby_and_aggregate
    result = grouped.apply(how, *args, **kwargs)
  File "/home/travis/build/pydata/pandas/pandas/core/groupby.py", line 645, in apply
    @wraps(func)
  File "/home/travis/miniconda/envs/pandas/lib/python2.7/functools.py", line 33, in update_wrapper
    setattr(wrapper, attr, getattr(wrapped, attr))
AttributeError: 'str' object has no attribute '__module__'
----------------------------------------------------------------------
Ran 10105 tests in 537.776s
FAILED (SKIP=177, errors=1)
```
 I remember seeing those. I think an attribute is being passed which isn't defined for that object
e.g. `nunique` for a DataFrame will cause this.
 want to rebase/update
 Thanks for update. But I can't find tests what I meant. Can u add below 4 cases?

```
pd.PeriodIndex._simple_new([pd.Period('2011-01', freq='M')])
pd.PeriodIndex._simple_new(np.array([pd.Period('2011-01', freq='M')]))
pd.PeriodIndex._simple_new([1.1], freq='M')
pd.PeriodIndex._simple_new(np.array([1.1]), freq='M')
```
 @sinhrks do we want to stop this: https://github.com/SixtyCapital/pandas/blob/master/pandas/tseries/period.py#L178-L178 ?

Or just in `_simple_new`?
 Ah, i dont stick to `float` to raise errors. Asking `list` and `ndarray` outputs the same.

Can u compare `_simple_new` and `__new__` results in above cases?
 > Ah, i dont stick to float to raise errors. Asking list and ndarray outputs the same.

I'm not sure I understand...

> Can u compare _simple_new and __new__ results in above cases?

They'll be fairly similar. At the moment I'm raising if someone passes floats to `_simple_new`, but keeping the coercion in `__new__`. I also think that not coercing floats anywhere would be very reasonable
 @jreback @sinhrks ready for review
 OK, Fixed DataFrames too, & combined tests across Datetime & Period indexes
 is that #13212 ?
 > is that #13212 ?

Yup!
 Should I remove this test now @jreback? I think it's covered by the Base tests now https://github.com/pydata/pandas/blob/master/pandas/tseries/tests/test_resample.py#L1411
 yes (just inspect it to make sure that we are covering the bases)
 OK, I moved a couple around to ensure we weren't losing anything
 @jreback @sinhrks Green!
 thanks @MaximilianR @sinhrks this is great8!

small issue. I am not convinced that we are testing `IncompatibleFrequency` fully, IOW we may be just testing for `ValueError`. But that's a minor point & can be done as a followup.
 thanks @MaximilianR :)
