Description
Code Sample
import pandas as pd
data = [['a', 0.0], ['a', float('nan')], ['b', 1.0], ['b', float('nan')]]
df = pd.DataFrame(data, columns=['key', 'values'])
print(df.groupby('key').transform('ffill'))
print(df.groupby('key')['values'].transform('ffill'))
Problem description
The first print statement produces
values
0 0.0
1 0.0
2 1.0
3 1.0
The second print statement produces
0 0.0
1 0.0
2 0.0
3 0.0
Expected Output
I expected both operations to compute the same values. I regard the first output as the correct one.
Output of pd.show_versions()
INSTALLED VERSIONS
commit: None
python: 3.5.2.final.0
python-bits: 64
OS: Linux
OS-release: 4.4.0-139-generic
machine: x86_64
processor: x86_64
byteorder: little
LC_ALL: None
LANG: en_US.UTF-8
LOCALE: en_US.UTF-8
pandas: 0.23.4
pytest: 4.0.1
pip: 18.1
setuptools: 40.6.2
Cython: None
numpy: 1.15.4
scipy: 1.1.0
pyarrow: None
xarray: None
IPython: 7.2.0
sphinx: None
patsy: 0.5.1
dateutil: 2.7.5
pytz: 2018.7
blosc: None
bottleneck: None
tables: 3.4.4
numexpr: 2.6.8
feather: None
matplotlib: 3.0.2
openpyxl: None
xlrd: 1.1.0
xlwt: None
xlsxwriter: 0.7.3
lxml: None
bs4: 4.6.3
html5lib: 1.0.1
sqlalchemy: None
pymysql: None
psycopg2: None
jinja2: 2.10
s3fs: None
fastparquet: None
pandas_gbq: None
pandas_datareader: 0.7.0