-
-
Notifications
You must be signed in to change notification settings - Fork 18.4k
BUG: .fillna(-1)
does not work in pd.eval
#46471
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
Labels
Comments
Thanks for the report! Further investigations and PRs to fix are most welcome. |
take |
take |
shyamsantoki
added a commit
to shyamsantoki/pandas
that referenced
this issue
Apr 16, 2022
Adding ```self.value``` resolves the issue pandas-dev#46471
4 tasks
shyamsantoki
added a commit
to shyamsantoki/pandas
that referenced
this issue
May 3, 2022
shyamsantoki
added a commit
to shyamsantoki/pandas
that referenced
this issue
Jun 18, 2022
shyamsantoki
added a commit
to shyamsantoki/pandas
that referenced
this issue
Jun 18, 2022
5 tasks
5 tasks
It can be implemented in the following ways: import pandas as pd
import numpy as np
df = pd.DataFrame([np.nan,1,1], columns=['A'])
result = df.eval('A.fillna(@negative(1))',local_dict={'negative':lambda x:-x}) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Pandas version checks
I have checked that this issue has not already been reported.
I have confirmed this bug exists on the latest version of pandas.
I have confirmed this bug exists on the main branch of pandas.
Reproducible Example
Issue Description
.eval
seems to be having some problems with negative values. A very similar issue has been reported, summarized and closed here: #16363However, it clearly still persists in other instances.
Expected Behavior
test_unary(-1) # works
Installed Versions
INSTALLED VERSIONS
commit : 66e3805
python : 3.9.10.final.0
python-bits : 64
OS : Linux
OS-release : 5.13.0-35-generic
Version : #40~20.04.1-Ubuntu SMP Mon Mar 7 09:18:32 UTC 2022
machine : x86_64
processor : x86_64
byteorder : little
LC_ALL : None
LANG : en_US.UTF-8
LOCALE : en_US.UTF-8
pandas : 1.3.5
numpy : 1.21.2
pytz : 2021.3
dateutil : 2.8.2
pip : 21.3.1
setuptools : 58.2.0
Cython : None
pytest : None
hypothesis : None
sphinx : None
blosc : None
feather : None
xlsxwriter : None
lxml.etree : None
html5lib : None
pymysql : None
psycopg2 : None
jinja2 : 3.0.2
IPython : 7.28.0
pandas_datareader: None
bs4 : None
bottleneck : None
fsspec : 2021.11.1
fastparquet : None
gcsfs : None
matplotlib : 3.4.3
numexpr : None
odfpy : None
openpyxl : None
pandas_gbq : None
pyarrow : 5.0.0
pyxlsb : None
s3fs : 2021.11.1
scipy : 1.7.1
sqlalchemy : 1.4.25
tables : None
tabulate : 0.8.9
xarray : None
xlrd : None
xlwt : None
numba : 0.55.0
The text was updated successfully, but these errors were encountered: