Thanks to visit codestin.com
Credit goes to github.com

Skip to content

BUG: nanosecond & nanoseconds parameters of DateOffset object do not affects #44560

Closed
@idanhazan

Description

@idanhazan

  • 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

import pandas as pd

timestamp = pd.Timestamp('2020-11-21 10:20:30.123456789')

dateoffset = pd.DateOffset(nanosecond=100)
print(timestamp + dateoffset)  # Timestamp('2020-11-22 10:20:30.123456789')

dateoffset = pd.DateOffset(nanoseconds=100)
print(timestamp + dateoffset)  # Timestamp('2020-11-22 10:20:30.123456789')

dateoffset = pd.DateOffset(nanosecond=100, nanoseconds=100)
print(timestamp + dateoffset)  # Timestamp('2020-11-22 10:20:30.123456789')

Issue Description

Both of 'nanosecond' & 'nanoseconds' parameters of DateOffset object do not affects, Please take a look of the examples.

Expected Behavior

import pandas as pd

timestamp = pd.Timestamp('2020-11-21 10:20:30.123456789')

dateoffset = pd.DateOffset(nanosecond=100)
print(timestamp + dateoffset) # Timestamp('2020-11-22 10:20:30.123456100')

dateoffset = pd.DateOffset(nanoseconds=100)
print(timestamp + dateoffset) # Timestamp('2020-11-22 10:20:30.123456889')

dateoffset = pd.DateOffset(nanosecond=100, nanoseconds=100)
print(timestamp + dateoffset) # Timestamp('2020-11-22 10:20:30.123456200')

Installed Versions

INSTALLED VERSIONS

commit : 945c9ed
python : 3.9.7.final.0
python-bits : 64
OS : Linux
OS-release : 5.13.0-21-generic
Version : #21-Ubuntu SMP Tue Oct 19 08:59:28 UTC 2021
machine : x86_64
processor : x86_64
byteorder : little
LC_ALL : None
LANG : en_IL
LOCALE : en_IL.UTF-8

pandas : 1.3.4
numpy : 1.21.2
pytz : 2021.3
dateutil : 2.8.2
pip : 21.2.4
setuptools : 58.0.4
Cython : None
pytest : None
hypothesis : None
sphinx : 4.2.0
blosc : None
feather : None
xlsxwriter : None
lxml.etree : 4.6.3
html5lib : None
pymysql : None
psycopg2 : 2.8.6 (dt dec pq3 ext lo64)
jinja2 : 3.0.2
IPython : 7.29.0
pandas_datareader: None
bs4 : None
bottleneck : 1.3.2
fsspec : 2021.10.1
fastparquet : None
gcsfs : None
matplotlib : 3.4.3
numexpr : 2.7.3
odfpy : None
openpyxl : None
pandas_gbq : None
pyarrow : None
pyxlsb : None
s3fs : None
scipy : 1.7.1
sqlalchemy : 1.4.22
tables : None
tabulate : None
xarray : None
xlrd : None
xlwt : None
numba : None

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions