Skip to content

BUG: Lacking milliseconds field in DateOffset #43371

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
isVoid opened this issue Sep 2, 2021 · 1 comment · Fixed by #43598
Closed
2 of 3 tasks

BUG: Lacking milliseconds field in DateOffset #43371

isVoid opened this issue Sep 2, 2021 · 1 comment · Fixed by #43598
Labels
Milestone

Comments

@isVoid
Copy link
Contributor

isVoid commented Sep 2, 2021

  • I have checked that this issue has not already been reported.

  • I have confirmed this bug exists on the latest version of pandas.

  • (optional) I have confirmed this bug exists on the master branch of pandas.


Code Sample, a copy-pastable example

# Your code here
>>> import pandas as pd
>>> pd.date_range(start='2000-01-01 08:00:00', end='2000-01-01 08:00:01', freq='1L')
DatetimeIndex([       '2000-01-01 08:00:00', '2000-01-01 08:00:00.001000',
               '2000-01-01 08:00:00.002000', '2000-01-01 08:00:00.003000',
               '2000-01-01 08:00:00.004000', '2000-01-01 08:00:00.005000',
               '2000-01-01 08:00:00.006000', '2000-01-01 08:00:00.007000',
               '2000-01-01 08:00:00.008000', '2000-01-01 08:00:00.009000',
               ...
               '2000-01-01 08:00:00.991000', '2000-01-01 08:00:00.992000',
               '2000-01-01 08:00:00.993000', '2000-01-01 08:00:00.994000',
               '2000-01-01 08:00:00.995000', '2000-01-01 08:00:00.996000',
               '2000-01-01 08:00:00.997000', '2000-01-01 08:00:00.998000',
               '2000-01-01 08:00:00.999000',        '2000-01-01 08:00:01'],
              dtype='datetime64[ns]', length=1001, freq='L')
>>> pd.date_range(start='2000-01-01 08:00:00', end='2000-01-01 08:00:01', freq=pd.DateOffset(milliseconds=1))
DatetimeIndex(['2000-01-01 08:00:00'], dtype='datetime64[ns]', freq='<DateOffset>')

Problem description

Today, I can specify 1 millisecond offset in date_range by offset alias 1L or 1ms. But I cannot specify this offset through pd.DateOffset because its lacking a milliseconds field.

Expected Output

Similar to the case specified with offset alias L or ms.

Output of pd.show_versions()

INSTALLED VERSIONS

commit : 7c48ff4
python : 3.7.10.final.0
python-bits : 64
OS : Linux
OS-release : 4.15.0-76-generic
Version : #86-Ubuntu SMP Fri Jan 17 17:24:28 UTC 2020
machine : x86_64
processor : x86_64
byteorder : little
LC_ALL : None
LANG : None
LOCALE : en_US.UTF-8

pandas : 1.2.5
numpy : 1.21.2
pytz : 2021.1
dateutil : 2.8.1
pip : 21.2.4
setuptools : 52.0.0.post20210125
Cython : 0.29.24
pytest : 6.2.4
hypothesis : 6.17.2
sphinx : 4.1.2
blosc : None
feather : None
xlsxwriter : None
lxml.etree : None
html5lib : None
pymysql : None
psycopg2 : None
jinja2 : 2.11.3
IPython : 7.27.0
pandas_datareader: None
bs4 : 4.9.3
bottleneck : None
fsspec : 2021.07.0
fastparquet : None
gcsfs : None
matplotlib : 3.4.3
numexpr : None
odfpy : None
openpyxl : None
pandas_gbq : None
pyarrow : 5.0.0
pyxlsb : None
s3fs : None
scipy : 1.5.3
sqlalchemy : None
tables : None
tabulate : None
xarray : None
xlrd : None
xlwt : None

@isVoid isVoid added Bug Needs Triage Issue that has not been reviewed by a pandas team member labels Sep 2, 2021
@venaturum
Copy link
Contributor

This seems more like a feature request than a bug. The documentation doesn't list microseconds as being a valid frequency for DateOffset.

@simonjayhawkins simonjayhawkins added Enhancement Frequency DateOffsets and removed Bug Needs Triage Issue that has not been reviewed by a pandas team member labels Sep 3, 2021
@simonjayhawkins simonjayhawkins added this to the Contributions Welcome milestone Sep 3, 2021
@jreback jreback modified the milestones: Contributions Welcome, 1.4 Oct 29, 2021
@jreback jreback modified the milestones: 1.4, Contributions Welcome Dec 23, 2021
@jreback jreback modified the milestones: Contributions Welcome, 1.5 Mar 16, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants