-
-
Notifications
You must be signed in to change notification settings - Fork 18.1k
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
in consistent result with replace(np.nan, None, inplace=True) #17494
Comments
you would have to show a minimal reproducible example that can be copy pasted. |
Use df.where instead.
See: |
The issue you're hitting is that You can circumvent this behavior by passing the
Note that with the above command we're ACTUALLY telling pandas:
Achieve desired result by passing a dictionary into replace.
|
@CRiddler Thanks for the explanation. Closing the issue as it is not a bug. |
@CRiddler One small question, what's the behaviours for Why this occurred ? |
method='pad' is the same as method='fill', so in this case you were forward filling the last observable value over
I can't remember the specifics of your original question, but |
This clarifies my question. Thanks :) 👍 |
I'm trying to replace np.nan with None, so that I can query the parquet files from presto like
is null
oris not null
.I've done
df.column_name.replace(np.nan, None, inplace=True)
Expected it to fill 'nan' with None. But, it will some of the columns with the value from columns where it is not nan.
But I couldn't understand why it filled another additional fields, and why only some of the fields filled up why not all though it is not expected behaviour?
INSTALLED VERSIONS
commit: None
python: 2.7.12.final.0
python-bits: 64
OS: Linux
OS-release: 4.4.0-1032-aws
machine: x86_64
processor: x86_64
byteorder: little
LC_ALL: None
LANG: en_US.UTF-8
LOCALE: None.None
pandas: 0.20.3
pytest: 3.2.1
pip: 9.0.1
setuptools: 36.4.0
Cython: 0.26.1
numpy: 1.13.1
scipy: None
xarray: None
IPython: None
sphinx: None
patsy: None
dateutil: 2.6.1
pytz: 2017.2
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: 0.1.2
pandas_gbq: None
pandas_datareader: None
The text was updated successfully, but these errors were encountered: