Skip to content

ffill, bfill are broken #21388

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
VelizarVESSELINOV opened this issue Jun 8, 2018 · 7 comments
Closed

ffill, bfill are broken #21388

VelizarVESSELINOV opened this issue Jun 8, 2018 · 7 comments
Labels
Testing pandas testing functions or related to the test suite

Comments

@VelizarVESSELINOV
Copy link

"""Pandas bug."""
from io import StringIO

from pandas import read_csv

dtf = read_csv(StringIO('''G,M
G1253,
G1253,0
G1253,0
G1253,
G1253,
G1253,21.3
G1253,32.3
G1253,98.5
G1253,
G1253,121.9
G1253,
G1253,125.6
G1253,136.6
G1253,
G1253,144.2
G1253,
G1253,161.8
G1253,
G1253,180.1
G1253,180.1'''))

grp = dtf.groupby('G')

dtf['M1'] = grp.M.ffill()
dtf['M2'] = grp.M.fillna(method='ffill')

print(dtf[dtf.M1 != dtf.M2][['M1', 'M2']])

assert(dtf.M1.equals(dtf.M2))

Problem description

Expect ffill to be working and equal to fillna(ffill)

Output of pd.show_versions()

INSTALLED VERSIONS

commit: None
python: 3.6.5.final.0
python-bits: 64
OS: Darwin
OS-release: 17.5.0
machine: x86_64
processor: i386
byteorder: little
LC_ALL: None
LANG: en_US.UTF-8
LOCALE: en_US.UTF-8

pandas: 0.23.0
pytest: None
pip: 10.0.1
setuptools: 39.0.1
Cython: None
numpy: 1.14.2
scipy: 1.1.0
pyarrow: 0.9.0.post1
xarray: None
IPython: 6.2.1
sphinx: None
patsy: None
dateutil: 2.7.2
pytz: 2018.3
blosc: None
bottleneck: None
tables: 3.4.3
numexpr: 2.6.4
feather: None
matplotlib: 2.2.0
openpyxl: 2.5.0
xlrd: 1.1.0
xlwt: 1.3.0
xlsxwriter: None
lxml: 4.2.1
bs4: None
html5lib: 0.9999999
sqlalchemy: None
pymysql: None
psycopg2: None
jinja2: 2.10
s3fs: None
fastparquet: None
pandas_gbq: None
pandas_datareader: None

@WillAyd
Copy link
Member

WillAyd commented Jun 8, 2018

I couldn't reproduce this on master - what difference are you actually seeing?

@WillAyd WillAyd added the Needs Info Clarification about behavior needed to assess issue label Jun 8, 2018
@VelizarVESSELINOV
Copy link
Author

VelizarVESSELINOV commented Jun 8, 2018

       M1     M2
0     NaN    NaN
3    21.3    0.0
4    21.3    0.0
8   121.9   98.5
10  125.6  121.9
13  144.2  136.6
15  161.8  144.2
17    NaN  161.8
Traceback (most recent call last):  File "bug1.py", line 35, in <module>
    assert(dtf.M1.equals(dtf.M2))
AssertionError

@WillAyd
Copy link
Member

WillAyd commented Jun 8, 2018

Hmm OK. I was able to reproduce on v0.23 but not on master - can you try on the latter and confirm it is resolved there?

@uds5501
Copy link
Contributor

uds5501 commented Jun 8, 2018

@VelizarVESSELINOV Use current master build. Their is no such error here:

>>> print(dtf[dtf.M1 != dtf.M2][['M1', 'M2']])
   M1  M2
0 NaN NaN

although the error still persists in v.0.23.0 (triaged succesfully there and can confirm with your output)

@VelizarVESSELINOV
Copy link
Author

I'm surprised that v0.23 contains so basic bug that was not caught by your automatic testing and it is taking so much time to deliver a fix version. When is it expected v0.23.1 version?

Can I assume that fillna(method='f/bfill') is working in v0.23?

Didn't manage to compile the pandas master after several tentatives, so I trust you that it is fixed in the master.

@WillAyd WillAyd added Testing pandas testing functions or related to the test suite and removed Needs Info Clarification about behavior needed to assess issue labels Jun 8, 2018
@WillAyd
Copy link
Member

WillAyd commented Jun 8, 2018

@VelizarVESSELINOV v0.23.1 is slated for release today. Given you just opened this 5 hours ago, I'd say that's a fairly quick turnaround :-)

@WillAyd
Copy link
Member

WillAyd commented Jun 8, 2018

Resolved via #21212

@WillAyd WillAyd closed this as completed Jun 8, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Testing pandas testing functions or related to the test suite
Projects
None yet
Development

No branches or pull requests

3 participants