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: The nanoseconds in pd.DateOffset was ignored when add to pd.Series #47856

Closed
2 of 3 tasks
seanslma opened this issue Jul 26, 2022 · 1 comment · Fixed by #48008
Closed
2 of 3 tasks

BUG: The nanoseconds in pd.DateOffset was ignored when add to pd.Series #47856

seanslma opened this issue Jul 26, 2022 · 1 comment · Fixed by #48008
Assignees
Labels
Bug Needs Triage Issue that has not been reviewed by a pandas team member

Comments

@seanslma
Copy link

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

import pandas as pd

t = pd.Timestamp('2022-01-01')
s = pd.Series([t])

# Output is `2022-01-01 00:30:00`
s + pd.DateOffset(minutes=30)

# Output is `2022-01-01`, nanoseconds offset was ignored
s + pd.DateOffset(nanoseconds=1800000000000)

# Output is `2022-01-01 00:30:00`
s[0] + pd.DateOffset(nanoseconds=1800000000000)

Issue Description

When a pandas date Series adding a DateOffset with component nanoseconds the offset was ignored.

Expected Behavior

The offset component nanoseconds should be added to each value of the Series. So the result should be 2022-01-01 00:30:00.

Installed Versions

pd.show_versions()
C:\Users\usr\conda-envs\my-env\lib\site-packages_distutils_hack_init_.py:33: UserWarning: Setuptools is replacing distutils.
warnings.warn("Setuptools is replacing distutils.")

INSTALLED VERSIONS

commit : e8093ba
python : 3.9.13.final.0
python-bits : 64
OS : Windows
OS-release : 10
Version : 10.0.19043
machine : AMD64
processor : Intel64 Family 6 Model 58 Stepping 0, GenuineIntel
byteorder : little
LC_ALL : None
LANG : None
LOCALE : English_Australia.1252

pandas : 1.4.3
numpy : 1.22.4
pytz : 2022.1
dateutil : 2.8.2
setuptools : 62.6.0
pip : 22.1.2
Cython : 0.29.30
pytest : 7.1.2
hypothesis : None
sphinx : None
blosc : None
feather : None
xlsxwriter : None
lxml.etree : 4.9.0
html5lib : None
pymysql : None
psycopg2 : None
jinja2 : 3.1.2
IPython : 8.4.0
pandas_datareader: None
bs4 : 4.11.1
bottleneck : None
brotli :
fastparquet : None
fsspec : 2022.5.0
gcsfs : None
markupsafe : 2.1.1
matplotlib : 3.5.2
numba : 0.55.2
numexpr : None
odfpy : None
openpyxl : 3.0.9
pandas_gbq : None
pyarrow : 7.0.0
pyreadstat : None
pyxlsb : None
s3fs : None
scipy : 1.8.1
snappy : None
sqlalchemy : 1.4.39
tables : None
tabulate : None
xarray : 2022.3.0
xlrd : None
xlwt : None
zstandard : None

@seanslma seanslma added Bug Needs Triage Issue that has not been reviewed by a pandas team member labels Jul 26, 2022
@srotondo
Copy link
Contributor

srotondo commented Aug 4, 2022

take

srotondo pushed a commit to srotondo/pandas that referenced this issue Aug 8, 2022
srotondo pushed a commit to srotondo/pandas that referenced this issue Aug 9, 2022
srotondo pushed a commit to srotondo/pandas that referenced this issue Aug 9, 2022
mroeschke added a commit that referenced this issue Aug 10, 2022
* BUG: Fixed ignoring of nanoseconds when adding to series #47856

* Update doc/source/whatsnew/v1.5.0.rst

Co-authored-by: Matthew Roeschke <[email protected]>

* BUG: Renamed test variables #47856

* BUG: Changed added if-else for performance #47856

* Update pandas/_libs/tslibs/offsets.pyx

Co-authored-by: Matthew Roeschke <[email protected]>

* BUG: Used getattr for nano check #47856

Co-authored-by: Steven Rotondo <[email protected]>
Co-authored-by: Matthew Roeschke <[email protected]>
noatamir pushed a commit to noatamir/pandas that referenced this issue Nov 9, 2022
…7856 (pandas-dev#48008)

* BUG: Fixed ignoring of nanoseconds when adding to series pandas-dev#47856

* Update doc/source/whatsnew/v1.5.0.rst

Co-authored-by: Matthew Roeschke <[email protected]>

* BUG: Renamed test variables pandas-dev#47856

* BUG: Changed added if-else for performance pandas-dev#47856

* Update pandas/_libs/tslibs/offsets.pyx

Co-authored-by: Matthew Roeschke <[email protected]>

* BUG: Used getattr for nano check pandas-dev#47856

Co-authored-by: Steven Rotondo <[email protected]>
Co-authored-by: Matthew Roeschke <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug Needs Triage Issue that has not been reviewed by a pandas team member
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants