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: DatetimeIndex and Timestamp behave inconsistently with respect to pd.DateOffset #43784

Open
2 of 3 tasks
guyguyguy1234 opened this issue Sep 28, 2021 · 2 comments
Open
2 of 3 tasks
Assignees
Labels
Bug Numeric Operations Arithmetic, Comparison, and Logical operations Timeseries Timezones Timezone data dtype

Comments

@guyguyguy1234
Copy link

guyguyguy1234 commented Sep 28, 2021

  • 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 master branch of pandas.

Reproducible Example

pd.DatetimeIndex([pd.to_datetime('2020-10-25').tz_localize('Europe/Berlin')]) + pd.DateOffset(hours=3) 
returns 
2020-10-25 03:00:00+01:00

while

pd.to_datetime('2020-10-25').tz_localize('Europe/Berlin') + pd.DateOffset(hours=3) 
returns 
Timestamp('2020-10-25 02:00:00+0100', tz='Europe/Berlin')

Issue Description

Mismatch between the outputs.

Here is the stackoverflow post describing in detail the issue.

Expected Behavior

Returning same datetime

Installed Versions

INSTALLED VERSIONS

commit : 73c6825
python : 3.9.4.final.0
python-bits : 64
OS : Windows
OS-release : 10
Version : 10.0.19041
machine : AMD64
processor : Intel64 Family 6 Model 165 Stepping 2, GenuineIntel
byteorder : little
LC_ALL : None
LANG : None
LOCALE : English_United States.1252

pandas : 1.3.3
numpy : 1.19.5
pytz : 2021.1
dateutil : 2.8.1
pip : 21.2.4
setuptools : 52.0.0.post20210125
Cython : 0.29.23
pytest : 6.2.3
hypothesis : None
sphinx : 4.0.1
blosc : None
feather : None
xlsxwriter : 1.3.8
lxml.etree : 4.6.3
html5lib : 1.1
pymysql : None
psycopg2 : None
jinja2 : 2.11.3
IPython : 7.22.0
pandas_datareader: None
bs4 : 4.9.3
bottleneck : 1.3.2
fsspec : 0.9.0
fastparquet : None
gcsfs : None
matplotlib : 3.3.4
numexpr : 2.7.3
odfpy : None
openpyxl : 3.0.7
pandas_gbq : None
pyarrow : None
pyxlsb : 1.0.8
s3fs : None
scipy : 1.6.2
sqlalchemy : 1.4.7
tables : None
tabulate : None
xarray : None
xlrd : 2.0.1
xlwt : 1.3.0
numba : 0.53.1

@guyguyguy1234 guyguyguy1234 added Bug Needs Triage Issue that has not been reviewed by a pandas team member labels Sep 28, 2021
@mroeschke mroeschke added Numeric Operations Arithmetic, Comparison, and Logical operations Timeseries Timezones Timezone data dtype and removed Needs Triage Issue that has not been reviewed by a pandas team member labels Oct 2, 2021
@srotondo
Copy link
Contributor

take

srotondo pushed a commit to srotondo/pandas that referenced this issue Aug 17, 2022
srotondo pushed a commit to srotondo/pandas that referenced this issue Aug 22, 2022
srotondo pushed a commit to srotondo/pandas that referenced this issue Sep 13, 2022
srotondo pushed a commit to srotondo/pandas that referenced this issue Sep 14, 2022
srotondo pushed a commit to srotondo/pandas that referenced this issue Sep 14, 2022
srotondo pushed a commit to srotondo/pandas that referenced this issue Sep 17, 2022
srotondo pushed a commit to srotondo/pandas that referenced this issue Jan 3, 2023
@srotondo
Copy link
Contributor

srotondo commented Jan 3, 2023

That last commit was a typo from an unrelated PR, ignore that.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug Numeric Operations Arithmetic, Comparison, and Logical operations Timeseries Timezones Timezone data dtype
Projects
None yet
3 participants