Skip to content
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

BUG: Numpy ufunc accumulate doesn't run correctly on Pandas 1.2.0 #39259

Closed
3 tasks done
quant-dc opened this issue Jan 18, 2021 · 2 comments · Fixed by #39260
Closed
3 tasks done

BUG: Numpy ufunc accumulate doesn't run correctly on Pandas 1.2.0 #39259

quant-dc opened this issue Jan 18, 2021 · 2 comments · Fixed by #39260
Labels
Regression Functionality that used to work in a prior pandas version
Milestone

Comments

@quant-dc
Copy link

quant-dc commented Jan 18, 2021

  • 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

import pandas as pd
import numpy as np

# %% Create random data

np.random.seed(50)
number_of_observations = 100
values = np.random.randn(number_of_observations)

# %% Form DataFrame

data = pd.DataFrame(values, columns=['A'])
data = data.cumsum()  # Get more local maximums for comparison

# %% Accumulate the maximum

pandas_accumulate = np.maximum.accumulate(data).to_numpy()
numpy_accumulate = np.maximum.accumulate(data.to_numpy())

assert np.allclose(pandas_accumulate, numpy_accumulate)

Problem description

Numpy maximum accumulate does nothing to the data compared with the same function applied to the numpy array (confirmed with axis argument specified too). Assert statement passed on pandas version 1.1.5. Broken in master as of writing also.

Expected Output

As previous version, the result of the numpy function in the pandas DataFrame.

Output of pd.show_versions()

INSTALLED VERSIONS

commit : 3e89b4c
python : 3.7.3.final.0
python-bits : 64
OS : Darwin
OS-release : 19.6.0
Version : Darwin Kernel Version 19.6.0: Tue Nov 10 00:10:30 PST 2020; root:xnu-6153.141.10~1/RELEASE_X86_64
machine : x86_64
processor : i386
byteorder : little
LC_ALL : None
LANG : None
LOCALE : en_GB.UTF-8
pandas : 1.2.0
numpy : 1.19.5
pytz : 2019.3
dateutil : 2.8.1
pip : 19.0.3
setuptools : 40.8.0
Cython : None
pytest : None
hypothesis : None
sphinx : None
blosc : None
feather : None
xlsxwriter : None
lxml.etree : 4.4.1
html5lib : None
pymysql : None
psycopg2 : None
jinja2 : 2.11.1
IPython : 7.12.0
pandas_datareader: None
bs4 : None
bottleneck : None
fsspec : None
fastparquet : None
gcsfs : None
matplotlib : None
numexpr : None
odfpy : None
openpyxl : None
pandas_gbq : None
pyarrow : None
pyxlsb : None
s3fs : None
scipy : None
sqlalchemy : None
tables : None
tabulate : None
xarray : None
xlrd : None
xlwt : None
numba : None

@quant-dc quant-dc added Bug Needs Triage Issue that has not been reviewed by a pandas team member labels Jan 18, 2021
@jorisvandenbossche jorisvandenbossche added Regression Functionality that used to work in a prior pandas version and removed Bug Needs Triage Issue that has not been reviewed by a pandas team member labels Jan 18, 2021
@jorisvandenbossche jorisvandenbossche added this to the 1.2.1 milestone Jan 18, 2021
@jorisvandenbossche
Copy link
Member

@quant-dc thanks a lot for the report. That's caused by #36955, will quickly look into a fix

@jorisvandenbossche
Copy link
Member

-> #39260

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Regression Functionality that used to work in a prior pandas version
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants