ZeroDivisionError when groupby on a empty group
#### Code Sample, a copy-pastable example if possible

```python
# Your code here
import numpy as np
import pandas as pd

df = pd.DataFrame({'A':[0,1,0],'B':[1.,np.nan,2.]})
df.groupby('A').B.rank(pct=True)

```
#### Problem description
See code example above. The problem occurs only when pct parameter is True

**Regression between 0.22 and 0.23.4.**
Before 0.23, the result was a series with NaN values for each group containing only NaN values.
Now it is throwing a **ZeroDivisionError**

#### Expected Output
Same output as 0.22

#### Output of ``pd.show_versions()``

<details>
INSTALLED VERSIONS
------------------
commit: None
python: 3.5.3.final.0
python-bits: 64
OS: Windows
OS-release: 7
machine: AMD64
processor: Intel64 Family 6 Model 45 Stepping 7, GenuineIntel
byteorder: little
LC_ALL: None
LANG: None
LOCALE: None.None

pandas: 0.23.4
pytest: None
pip: 18.0
setuptools: 40.2.0
Cython: None
numpy: 1.15.0
scipy: None
pyarrow: None
xarray: None
IPython: None
sphinx: None
patsy: None
dateutil: 2.7.3
pytz: 2018.5
blosc: None
bottleneck: None
tables: None
numexpr: None
feather: None
matplotlib: None
openpyxl: None
xlrd: None
xlwt: None
xlsxwriter: None
lxml: None
bs4: None
html5lib: None
sqlalchemy: None
pymysql: None
psycopg2: None
jinja2: None
s3fs: None
fastparquet: None
pandas_gbq: None
pandas_datareader: None
</details>
