Skip to content

BUG: Reduction operations fail #41074

Closed
@YarShev

Description

@YarShev
  • 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.


Note: Please read this guide detailing how to provide the necessary information for us to reproduce your bug.

Code Sample, a copy-pastable example

import pandas
pdf = pandas.DataFrame([1, 'a', True])

# behavior for pandas 1.2.3
pdf.prod(axis=0, min_count=1, numeric_only=False)
0    a
dtype: object

# behavior for pandas 1.2.4
pdf.prod(axis=0, min_count=1, numeric_only=False)
AssertionError: assert numeric_only is None

# behavior for pandas 1.2.3
pdf.sum(axis=0, min_count=1, numeric_only=False)
TypeError: unsupported operand type(s) for +: 'int' and 'str'

# behavior for pandas 1.2.4
pdf.sum(axis=0, min_count=1, numeric_only=False)
AssertionError: assert numeric_only is None

Problem description

Some of the reduction operations (namely, sum and prod) has changed own behavior in 1.2.4 comparing to 1.2.3. prod has become failing and sum has thrown another exception. Other reduction operations need to be checked as well.

Output of pd.show_versions()

pandas : 1.2.4
numpy : 1.19.5
pytz : 2021.1
dateutil : 2.8.1
pip : 20.2.4
setuptools : 50.3.1.post20201107
Cython : None
pytest : 6.2.2
hypothesis : None
sphinx : 3.5.1
blosc : None
feather : 0.4.1
xlsxwriter : None
lxml.etree : 4.6.2
html5lib : None
pymysql : None
psycopg2 : None
jinja2 : 2.11.3
IPython : 7.20.0
pandas_datareader: None
bs4 : 4.9.3
bottleneck : None
fsspec : 0.8.5
fastparquet : None
gcsfs : None
matplotlib : 3.2.2
numexpr : 2.7.2
odfpy : None
openpyxl : 3.0.6
pandas_gbq : 0.14.1
pyarrow : 1.0.0
pyxlsb : None
s3fs : None
scipy : 1.6.0
sqlalchemy : 1.3.23
tables : 3.6.1
tabulate : None
xarray : 0.16.2
xlrd : 2.0.1
xlwt : None
numba : None

Metadata

Metadata

Labels

BugNumeric OperationsArithmetic, Comparison, and Logical operationsRegressionFunctionality that used to work in a prior pandas version

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions