-
-
Notifications
You must be signed in to change notification settings - Fork 18.1k
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
DOC: add missing parameters to DateOffset classes: Milli, Micro and Nano #56336
Merged
Merged
Changes from 1 commit
Commits
Show all changes
4 commits
Select commit
Hold shift + click to select a range
d1aa17c
add parameters to milli, micro and nano
vinitaparasrampuria 39fd22d
corrected spaces between docstring of Milli,Micro, Nano
vinitaparasrampuria 407c971
Merge remote-tracking branch 'upstream/main' into date-offsets
vinitaparasrampuria 59c8275
removed whitespaces in Nano class
vinitaparasrampuria File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change | ||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|
|
@@ -1194,20 +1194,107 @@ cdef class Second(Tick): | |||||||||||
|
||||||||||||
|
||||||||||||
cdef class Milli(Tick): | ||||||||||||
""" | ||||||||||||
Offset ``n`` milliseconds. | ||||||||||||
|
||||||||||||
Parameters | ||||||||||||
---------- | ||||||||||||
n : int, default 1 | ||||||||||||
The number of milliseconds represented. | ||||||||||||
|
||||||||||||
See Also | ||||||||||||
-------- | ||||||||||||
:class:`~pandas.tseries.offsets.DateOffset` : Standard kind of date increment. | ||||||||||||
|
||||||||||||
Examples | ||||||||||||
-------- | ||||||||||||
You can use the parameter ``n`` to represent a shift of n milliseconds. | ||||||||||||
|
||||||||||||
>>> from pandas.tseries.offsets import Milli | ||||||||||||
>>> ts = pd.Timestamp(2022, 12, 9, 15) | ||||||||||||
>>> ts | ||||||||||||
Timestamp('2022-12-09 15:00:00') | ||||||||||||
|
||||||||||||
>>> ts + Milli(n=10) | ||||||||||||
Timestamp('2022-12-09 15:00:00.010000') | ||||||||||||
>>> ts - Milli(n=10) | ||||||||||||
Timestamp('2022-12-09 14:59:59.990000') | ||||||||||||
|
||||||||||||
>>> ts + Milli(n=-10) | ||||||||||||
Timestamp('2022-12-09 14:59:59.990000') | ||||||||||||
""" | ||||||||||||
_nanos_inc = 1_000_000 | ||||||||||||
_prefix = "ms" | ||||||||||||
_period_dtype_code = PeriodDtypeCode.L | ||||||||||||
_creso = NPY_DATETIMEUNIT.NPY_FR_ms | ||||||||||||
|
||||||||||||
|
||||||||||||
cdef class Micro(Tick): | ||||||||||||
""" | ||||||||||||
Offset ``n`` microseconds. | ||||||||||||
|
||||||||||||
Parameters | ||||||||||||
---------- | ||||||||||||
n : int, default 1 | ||||||||||||
The number of microseconds represented. | ||||||||||||
|
||||||||||||
See Also | ||||||||||||
-------- | ||||||||||||
:class:`~pandas.tseries.offsets.DateOffset` : Standard kind of date increment. | ||||||||||||
|
||||||||||||
Examples | ||||||||||||
-------- | ||||||||||||
You can use the parameter ``n`` to represent a shift of n microseconds. | ||||||||||||
|
||||||||||||
>>> from pandas.tseries.offsets import Micro | ||||||||||||
>>> ts = pd.Timestamp(2022, 12, 9, 15) | ||||||||||||
>>> ts | ||||||||||||
Timestamp('2022-12-09 15:00:00') | ||||||||||||
|
||||||||||||
>>> ts + Micro(n=1000) | ||||||||||||
Timestamp('2022-12-09 15:00:00.001000') | ||||||||||||
>>> ts - Micro(n=1000) | ||||||||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||||||||
Timestamp('2022-12-09 14:59:59.999000') | ||||||||||||
|
||||||||||||
>>> ts + Micro(n=-1000) | ||||||||||||
Timestamp('2022-12-09 14:59:59.999000') | ||||||||||||
""" | ||||||||||||
_nanos_inc = 1000 | ||||||||||||
_prefix = "us" | ||||||||||||
_period_dtype_code = PeriodDtypeCode.U | ||||||||||||
_creso = NPY_DATETIMEUNIT.NPY_FR_us | ||||||||||||
|
||||||||||||
|
||||||||||||
cdef class Nano(Tick): | ||||||||||||
""" | ||||||||||||
Offset ``n`` nanoseconds. | ||||||||||||
|
||||||||||||
Parameters | ||||||||||||
---------- | ||||||||||||
n : int, default 1 | ||||||||||||
The number of nanoseconds represented. | ||||||||||||
|
||||||||||||
See Also | ||||||||||||
-------- | ||||||||||||
:class:`~pandas.tseries.offsets.DateOffset` : Standard kind of date increment. | ||||||||||||
|
||||||||||||
Examples | ||||||||||||
-------- | ||||||||||||
You can use the parameter ``n`` to represent a shift of n nanoseconds. | ||||||||||||
|
||||||||||||
>>> from pandas.tseries.offsets import Nano | ||||||||||||
>>> ts = pd.Timestamp(2022, 12, 9, 15) | ||||||||||||
>>> ts | ||||||||||||
Timestamp('2022-12-09 15:00:00') | ||||||||||||
|
||||||||||||
>>> ts + Nano(n=1000) | ||||||||||||
Timestamp('2022-12-09 15:00:00.000001') | ||||||||||||
>>> ts - Nano(n=1000) | ||||||||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||||||||
Timestamp('2022-12-09 14:59:59.999999') | ||||||||||||
|
||||||||||||
>>> ts + Nano(n=-1000) | ||||||||||||
Timestamp('2022-12-09 14:59:59.999999') | ||||||||||||
""" | ||||||||||||
_nanos_inc = 1 | ||||||||||||
_prefix = "ns" | ||||||||||||
_period_dtype_code = PeriodDtypeCode.N | ||||||||||||
|
@@ -3073,9 +3160,12 @@ cdef class SemiMonthEnd(SemiMonthOffset): | |||||||||||
|
||||||||||||
Parameters | ||||||||||||
---------- | ||||||||||||
n : int | ||||||||||||
n : int, default 1 | ||||||||||||
The number of months represented. | ||||||||||||
normalize : bool, default False | ||||||||||||
Normalize start/end dates to midnight before generating date range. | ||||||||||||
day_of_month : int, {1, 3,...,27}, default 15 | ||||||||||||
A specific integer for the day of the month. | ||||||||||||
|
||||||||||||
Examples | ||||||||||||
-------- | ||||||||||||
|
@@ -3113,9 +3203,12 @@ cdef class SemiMonthBegin(SemiMonthOffset): | |||||||||||
|
||||||||||||
Parameters | ||||||||||||
---------- | ||||||||||||
n : int | ||||||||||||
n : int, default 1 | ||||||||||||
The number of months represented. | ||||||||||||
normalize : bool, default False | ||||||||||||
day_of_month : int, {2, 3,...,27}, default 15 | ||||||||||||
Normalize start/end dates to midnight before generating date range. | ||||||||||||
day_of_month : int, {1, 3,...,27}, default 15 | ||||||||||||
A specific integer for the day of the month. | ||||||||||||
|
||||||||||||
Examples | ||||||||||||
-------- | ||||||||||||
|
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.