df.eval: "log10" is not a supported function · Issue #24139 · pandas-dev/pandas (original) (raw)
Code Sample, a copy-pastable example if possible
import pandas as pd import numpy as np df = pd.DataFrame({'a': np.random.randn(10)}) a = df.a expr_works = "log(a)/log(10)" expr_notsupported = "log10(a)" out_works = df.eval(expr_works) out_notsupported = df.eval(expr_notsupported)
Problem description
As expected,
"\"{0}\" is not a supported function".format(name))
ValueError: "log10" is not a supported function
I know we can substitute the log10(a) behaviour with log(a)/log(10) but the pull request fix I'll post is a one word addition and makes things way more readable when you have long expressions
Expected Output
Output of pd.show_versions()
[paste the output of ``pd.show_versions()`` here below this line] pd.show_versions() INSTALLED VERSIONS ------------------ commit: 5f46a28python: 3.6.7.final.0 python-bits: 64 OS: Linux OS-release: 4.18.0-2-amd64 machine: x86_64 processor: byteorder: little LC_ALL: None LANG: en_GB.UTF-8 LOCALE: en_GB.UTF-8 pandas: 0.23.4 pytest: 4.0.1 pip: 10.0.1 setuptools: 39.1.0 Cython: 0.29.1 numpy: 1.15.4 scipy: 1.1.0 pyarrow: 0.11.1 xarray: 0.11.0 IPython: 7.2.0 sphinx: 1.8.2 patsy: 0.5.1 dateutil: 2.7.5 pytz: 2018.7 blosc: 1.6.2 bottleneck: 1.2.1 tables: 3.4.4 numexpr: 2.6.8 feather: None matplotlib: 3.0.2 openpyxl: 2.5.12 xlrd: 1.1.0 xlwt: 1.3.0 xlsxwriter: 1.1.2 lxml: 4.2.5 bs4: 4.6.3 html5lib: 1.0.1 sqlalchemy: 1.2.14 pymysql: None psycopg2: None jinja2: 2.10 s3fs: None fastparquet: 0.2.0 pandas_gbq: None pandas_datareader: None