BUG: Numpy ufunc accumulate doesn't run correctly on Pandas 1.2.0 · Issue #39259 · pandas-dev/pandas (original) (raw)
- 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