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: DatetimeIndex with nanosecond frequency does not include end #13672

Closed
ChadFulton opened this issue Jul 16, 2016 · 1 comment
Closed

BUG: DatetimeIndex with nanosecond frequency does not include end #13672

ChadFulton opened this issue Jul 16, 2016 · 1 comment
Labels
Bug Datetime Datetime data dtype Frequency DateOffsets
Milestone

Comments

@ChadFulton
Copy link

I'm not sure if this is a bug or intended behavior, but documentation says "If periods is none, generated index will extend to first conforming time on or just past end argument", and it appears here that in the nanosecond frequency case, the generated index only extends to just before the end argument.

Code Sample, a copy-pastable example if possible

> start = pd.Timestamp(1)
> end = pd.Timestamp(4)
> pd.DatetimeIndex(start=start, end=end, freq='N')
DatetimeIndex(['1970-01-01 00:00:00.000000001',
               '1970-01-01 00:00:00.000000002',
               '1970-01-01 00:00:00.000000003'],
              dtype='datetime64[ns]', freq='N')

whereas a similar call with annual frequency gives:

> start = pd.Timestamp('1971')
> end = pd.Timestamp('1974')
> pd.DatetimeIndex(start=start, end=end, freq='AS')
DatetimeIndex(['1971-01-01',
               '1972-01-01',
               '1973-01-01',
               '1974-01-01'],
              dtype='datetime64[ns]', freq='AS-JAN')

output of pd.show_versions()

pandas: 0.18.0

@sinhrks sinhrks added Datetime Datetime data dtype Frequency DateOffsets Bug labels Jul 16, 2016
@sinhrks
Copy link
Member

sinhrks commented Jul 16, 2016

Thanks for the report. Because the range is created by np.arange, we should have +1 margin if offset is Nano.

PR is appreciated:)

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

Successfully merging a pull request may close this issue.

3 participants