We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
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.
pd.Series(["kkkk", "llll"]).any() # "kkkk" any(["kkkk", "llll"]) # True pd.Series(["kkkk", "llll"]).all() # "llll" all(["kkkk", "llll"]) # True
Python returns boolean not the value. So we should follow that. https://stackoverflow.com/questions/10180344/why-does-python-any-return-a-bool-instead-of-the-value
The expected behavior is to match any and all built-in functions.
any
all
https://docs.python.org/3/library/functions.html#any
def any(iterable): for element in iterable: if element: return True return False
https://docs.python.org/3/library/functions.html#all
def all(iterable): for element in iterable: if not element: return False return True
pd.show_versions()
commit : 2a7d332 python : 3.7.8.final.0 python-bits : 64 OS : Linux OS-release : 4.19.112+ Version : #1 SMP Fri Sep 4 12:06:06 PDT 2020 machine : x86_64 processor : x86_64 byteorder : little LC_ALL : en_US.UTF-8 LANG : en_US.UTF-8 LOCALE : en_US.UTF-8
pandas : 1.1.2 numpy : 1.19.1 pytz : 2020.1 dateutil : 2.8.1 pip : 20.1.1 setuptools : 49.2.0.post20200712 Cython : None pytest : None hypothesis : None sphinx : None blosc : None feather : None xlsxwriter : None lxml.etree : None html5lib : None pymysql : None psycopg2 : None jinja2 : 2.11.2 IPython : 7.16.1 pandas_datareader: None bs4 : None bottleneck : None fsspec : None fastparquet : None gcsfs : None matplotlib : 3.1.3 numexpr : None odfpy : None openpyxl : None pandas_gbq : None pyarrow : None pytables : None pyxlsb : None s3fs : None scipy : 1.5.2 sqlalchemy : 1.3.18 tables : None tabulate : None xarray : None xlrd : None xlwt : None numba : None
The text was updated successfully, but these errors were encountered:
pandas calls any and all on the corresponding ndarray.
s = np.asarray(["kkkk", "llll"], dtype=np.object) print(s.any())
also results in "kkkk". I don't know if there is a particular reason numpy (and hence, pandas) does this.
Sorry, something went wrong.
This seems to have happened before in #12863 (see also #30416).
I don't get the impression that its fixed though, so we either can figure out what's going on here or close this and continue the discussion there.
On numpy, a related issue.
Let's close in favor of #12863 / numpy/numpy#11857 to keep the discussion in one place (per project).
No branches or pull requests
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.
Code Sample, a copy-pastable example
Problem description
Python returns boolean not the value. So we should follow that.
https://stackoverflow.com/questions/10180344/why-does-python-any-return-a-bool-instead-of-the-value
Expected Output
The expected behavior is to match
any
andall
built-in functions.https://docs.python.org/3/library/functions.html#any
https://docs.python.org/3/library/functions.html#all
Output of
pd.show_versions()
INSTALLED VERSIONS
commit : 2a7d332
python : 3.7.8.final.0
python-bits : 64
OS : Linux
OS-release : 4.19.112+
Version : #1 SMP Fri Sep 4 12:06:06 PDT 2020
machine : x86_64
processor : x86_64
byteorder : little
LC_ALL : en_US.UTF-8
LANG : en_US.UTF-8
LOCALE : en_US.UTF-8
pandas : 1.1.2
numpy : 1.19.1
pytz : 2020.1
dateutil : 2.8.1
pip : 20.1.1
setuptools : 49.2.0.post20200712
Cython : None
pytest : None
hypothesis : None
sphinx : None
blosc : None
feather : None
xlsxwriter : None
lxml.etree : None
html5lib : None
pymysql : None
psycopg2 : None
jinja2 : 2.11.2
IPython : 7.16.1
pandas_datareader: None
bs4 : None
bottleneck : None
fsspec : None
fastparquet : None
gcsfs : None
matplotlib : 3.1.3
numexpr : None
odfpy : None
openpyxl : None
pandas_gbq : None
pyarrow : None
pytables : None
pyxlsb : None
s3fs : None
scipy : 1.5.2
sqlalchemy : 1.3.18
tables : None
tabulate : None
xarray : None
xlrd : None
xlwt : None
numba : None
The text was updated successfully, but these errors were encountered: