-
-
Notifications
You must be signed in to change notification settings - Fork 18.8k
Description
>>> pd.Series([True, np.float64(5)>0.2, np.nan]).sum()
1
>>> pd.Series([np.nan, np.float64(5)>0.2, True]).sum()
2
Problem description
The only thing different between the two cases above is the order of the arguments, which should not affect the result.
.mean() is also affected, and the same result occurs when using the series as a column in a dataframe.
Expected Output
I would expect both of the above to return 2, as there are two True values in the list
Output of pd.show_versions()
pandas : 0.25.3
numpy : 1.17.3
pytz : 2019.3
dateutil : 2.8.1
pip : 19.3.1
setuptools : 41.6.0.post20191030
Cython : 0.29.14
pytest : 5.2.2
hypothesis : None
sphinx : None
blosc : None
feather : None
xlsxwriter : None
lxml.etree : None
html5lib : None
pymysql : None
psycopg2 : None
jinja2 : None
IPython : 7.9.0
pandas_datareader: None
bs4 : None
bottleneck : None
fastparquet : None
gcsfs : None
lxml.etree : None
matplotlib : 3.1.1
numexpr : 2.7.0
odfpy : None
openpyxl : None
pandas_gbq : 0.11.0
pyarrow : None
pytables : None
s3fs : None
scipy : 1.3.1
sqlalchemy : None
tables : 3.6.1
xarray : None
xlrd : None
xlwt : None
xlsxwriter : None