Skip to content

BUG: pandas.tseries.offsets.Second() division #57264

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

Open
2 of 3 tasks
famenzel opened this issue Feb 5, 2024 · 2 comments
Open
2 of 3 tasks

BUG: pandas.tseries.offsets.Second() division #57264

famenzel opened this issue Feb 5, 2024 · 2 comments
Assignees
Labels
Bug Frequency DateOffsets Regression Functionality that used to work in a prior pandas version

Comments

@famenzel
Copy link

famenzel commented Feb 5, 2024

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.tseries.offsets as tso
a = tso.Second()/10
b = tso.Second()*.1

Issue Description

In contrast to tso.Minute(), tso.Day(), division with tso.Second() with any integer always results in tso.Day(0) (a). This is not the case with the corresponding multiplication (b). In previous pandas versions this did not happen.

Expected Behavior

tso.Second()/10 should return tso.Milli(100) and not tso.Day(0).

Installed Versions

INSTALLED VERSIONS

commit : f538741
python : 3.10.11.final.0
python-bits : 64
OS : Windows
OS-release : 10
Version : 10.0.22621
machine : AMD64
processor : Intel64 Family 6 Model 154 Stepping 4, GenuineIntel
byteorder : little
LC_ALL : None
LANG : de_DE.UTF-8
LOCALE : de_DE.cp1252

pandas : 2.2.0
numpy : 1.25.2
pytz : 2023.3.post1
dateutil : 2.8.2
setuptools : 65.5.0
pip : 23.0.1
Cython : None
pytest : 7.4.0
hypothesis : None
sphinx : None
blosc : None
feather : None
xlsxwriter : None
lxml.etree : None
html5lib : None
pymysql : None
psycopg2 : None
jinja2 : 3.1.2
IPython : 8.14.0
pandas_datareader : None
adbc-driver-postgresql: None
adbc-driver-sqlite : None
bs4 : None
bottleneck : None
dataframe-api-compat : None
fastparquet : None
fsspec : None
gcsfs : None
matplotlib : 3.7.3
numba : 0.58.0
numexpr : None
odfpy : None
openpyxl : None
pandas_gbq : None
pyarrow : None
pyreadstat : None
python-calamine : None
pyxlsb : None
s3fs : None
scipy : 1.11.3
sqlalchemy : 2.0.19
tables : None
tabulate : 0.9.0
xarray : None
xlrd : None
zstandard : None
tzdata : 2023.3
qtpy : None
pyqt5 : None

@famenzel famenzel added Bug Needs Triage Issue that has not been reviewed by a pandas team member labels Feb 5, 2024
@rhshadrach
Copy link
Member

Thanks for the report. Result of a git bisect:

commit 8b8f0d04795e80a9298688e55bb4164b597392bc
Author: jbrockmendel
Date:   Tue Dec 19 15:35:22 2023 -0800

    DEPR: Tick.delta (#56558)

cc @jbrockmendel

@rhshadrach rhshadrach added Regression Functionality that used to work in a prior pandas version Frequency DateOffsets and removed Needs Triage Issue that has not been reviewed by a pandas team member labels Feb 11, 2024
@rhshadrach rhshadrach added this to the 2.2.1 milestone Feb 11, 2024
@lithomas1 lithomas1 self-assigned this Feb 19, 2024
@lithomas1
Copy link
Member

Looks like the difference is with the _value attr on Timedelta

>>> pd.Timedelta(a)._value
1
>>> a.delta._value
<stdin>:1: FutureWarning: Second.delta is deprecated and will be removed in a future version. Use pd.Timedelta(obj) instead
1000000000

Taking a look

@lithomas1 lithomas1 modified the milestones: 2.2.1, 2.2.2 Feb 23, 2024
@lithomas1 lithomas1 modified the milestones: 2.2.2, 2.2.3 Apr 10, 2024
@lithomas1 lithomas1 modified the milestones: 2.2.3, 2.3 Sep 21, 2024
@mroeschke mroeschke removed this from the 2.3 milestone Jun 2, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug Frequency DateOffsets Regression Functionality that used to work in a prior pandas version
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants