Skip to content

BUG: DateOffset with nanoseconds does not apply to Timestamp #43892

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

Closed
2 of 3 tasks
emkornfield opened this issue Oct 5, 2021 · 2 comments · Fixed by #43968
Closed
2 of 3 tasks

BUG: DateOffset with nanoseconds does not apply to Timestamp #43892

emkornfield opened this issue Oct 5, 2021 · 2 comments · Fixed by #43968
Assignees
Labels
Bug Frequency DateOffsets
Milestone

Comments

@emkornfield
Copy link

  • 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

from pandas.tseries.offsets import DateOffset
from pandas import Timedelta, Timestamp

# With Timedelta this works as expected:
Timestamp(0) + Timedelta(nanoseconds=1, microseconds=1)
# >>> Timestamp('1970-01-01 00:00:00.000001001')

Timestamp(0) + DateOffset(nanoseconds=1, microseconds=1)
# >>> Timestamp('1970-01-01 00:00:00.000001')
(Timestamp(0) + DateOffset(nanoseconds=1, microseconds=1)).nanosecond
# >>> 0

Issue Description

The nanoseconds component DateOffset's does not appear to affect Timestamps when adding them.

Possibly related issue. #36589

Expected Behavior

I expect this to be the same behavior as pd.Timedelta as illustrated above.

Installed Versions

INSTALLED VERSIONS

commit : 73c6825
python : 3.9.7.final.0
python-bits : 64
OS : Linux
OS-release : 5.10.46-4rodete4-amd64
Version : #1 SMP Debian 5.10.46-4rodete4 (2021-09-06)
machine : x86_64
processor :
byteorder : little
LC_ALL : None
LANG : en_US.UTF-8
LOCALE : en_US.UTF-8

pandas : 1.3.3
numpy : 1.21.1
pytz : 2021.1
dateutil : 2.8.2
pip : 20.3.4
setuptools : 57.4.0
Cython : 0.29.24
pytest : 6.2.5
hypothesis : 6.23.1
sphinx : 4.1.2
blosc : None
feather : None
xlsxwriter : None
lxml.etree : None
html5lib : None
pymysql : None
psycopg2 : None
jinja2 : 3.0.1
IPython : None
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

@emkornfield emkornfield added Bug Needs Triage Issue that has not been reviewed by a pandas team member labels Oct 5, 2021
@mroeschke mroeschke added Frequency DateOffsets and removed Needs Triage Issue that has not been reviewed by a pandas team member labels Oct 6, 2021
@jorisvandenbossche jorisvandenbossche added this to the Contributions Welcome milestone Oct 6, 2021
@tushushu
Copy link
Contributor

tushushu commented Oct 8, 2021

Hi, may I work on this issue?

@tushushu
Copy link
Contributor

Working on in my forked repo, gonna put a PR later.
https://github.com/tushushu/pandas/tree/fix-bug-dateoffset-nanoseconds

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug Frequency DateOffsets
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants