-
-
Notifications
You must be signed in to change notification settings - Fork 18.4k
BUG: replacing a string with None causes an unexpected forward fill #36984
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
Comments
Note: replacing with np.nan does not cause this problem. |
Thanks for the fast answer. I would suggest that it may cause some silent errors, given that it does not fail. The behavior does indeed make sense, and it was 100% my mistake, but I fear that having "pad" as the default method may result in unexpected behaviors. Would it not make sense for it to not have a default method, and make the user make an explicit decision? |
I would agree that the behavior is confusing. Not sure what the rationale was for this specific scenario. A behavior change would probably need to be discussed (and then maybe go through a deprecation cycle if there is consensus). |
Just come here to mention that this is very confusing |
I have checked that this issue has not already been reported.
I have confirmed this bug exists on the latest version of pandas.
(optional) I have confirmed this bug exists on the master branch of pandas.
Note: Please read this guide detailing how to provide the necessary information for us to reproduce your bug.
Code Sample, a copy-pastable example
Problem description
[this should explain why the current behaviour is a problem and why the expected output is a better solution]
Expected Output
Replacing a string with a None should introduce a None, not forward fill the previous result.
Output of
pd.show_versions()
INSTALLED VERSIONS
commit : db08276
python : 3.6.5.final.0
python-bits : 64
OS : Darwin
OS-release : 19.6.0
Version : Darwin Kernel Version 19.6.0: Thu Jun 18 20:49:00 PDT 2020; root:xnu-6153.141.1~1/RELEASE_X86_64
machine : x86_64
processor : i386
byteorder : little
LC_ALL : None
LANG : en_US.UTF-8
LOCALE : en_US.UTF-8
pandas : 1.1.3
numpy : 1.19.2
pytz : 2018.9
dateutil : 2.8.1
pip : 20.2
setuptools : 49.2.0
Cython : None
pytest : 5.4.3
hypothesis : None
sphinx : 1.8.3
blosc : None
feather : None
xlsxwriter : None
lxml.etree : 4.5.1
html5lib : None
pymysql : None
psycopg2 : None
jinja2 : 2.10.1
IPython : 7.13.0
pandas_datareader: None
bs4 : 4.9.0
bottleneck : None
fsspec : None
fastparquet : None
gcsfs : None
matplotlib : 3.2.2
numexpr : None
odfpy : None
openpyxl : None
pandas_gbq : None
pyarrow : None
pytables : None
pyxlsb : None
s3fs : None
scipy : 1.4.1
sqlalchemy : 1.3.16
tables : None
tabulate : None
xarray : None
xlrd : None
xlwt : None
numba : None
The text was updated successfully, but these errors were encountered: