You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Best guess is that in PeriodArray._sub_period the line new_data = np.array([self.freq * x for x in new_data]) should be new_data = np.array([self.freq.base * x for x in new_data])
Pandas version checks
I have checked that this issue has not already been reported.
I have confirmed this bug exists on the latest version of pandas.
I have confirmed this bug exists on the main branch of pandas.
Reproducible Example
Issue Description
Period index simple arithmetic produces either unexpected, or even wrong results. In the provided example the output is
Expected Behavior
Using list comprehension instead of PeriodIndex directly:
produces:
as expected.
Installed Versions
pd.show_versions()
INSTALLED VERSIONS
commit : 06d2301
python : 3.9.6.final.0
python-bits : 64
OS : Linux
OS-release : 5.13.0-28-generic
Version : #31-Ubuntu SMP Thu Jan 13 17:41:06 UTC 2022
machine : x86_64
processor : x86_64
byteorder : little
LC_ALL : None
LANG : en_US.UTF-8
LOCALE : en_US.UTF-8
pandas : 1.4.1
numpy : 1.21.4
pytz : 2021.3
dateutil : 2.8.2
pip : 22.0.3
setuptools : 58.4.0
Cython : None
pytest : 6.2.5
hypothesis : None
sphinx : None
blosc : None
feather : None
xlsxwriter : None
lxml.etree : None
html5lib : None
pymysql : None
psycopg2 : None
jinja2 : 3.0.3
IPython : None
pandas_datareader: None
bs4 : None
bottleneck : None
fastparquet : None
fsspec : None
gcsfs : None
matplotlib : None
numba : None
numexpr : None
odfpy : None
openpyxl : None
pandas_gbq : None
pyarrow : 6.0.1
pyreadstat : None
pyxlsb : None
s3fs : None
scipy : 1.7.3
sqlalchemy : None
tables : None
tabulate : None
xarray : None
xlrd : None
xlwt : None
zstandard : None
The text was updated successfully, but these errors were encountered: