-
-
Notifications
You must be signed in to change notification settings - Fork 17.9k
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: update the pandas.date_range() docstring #20143
Changes from 1 commit
8c931ef
1cfb6db
0d6600e
887756b
184a063
fd64e2f
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2202,29 +2202,30 @@ def _generate_regular_range(start, end, periods, offset): | |
def date_range(start=None, end=None, periods=None, freq='D', tz=None, | ||
normalize=False, name=None, closed=None, **kwargs): | ||
""" | ||
Return a fixed frequency DatetimeIndex, with day (calendar) as the default | ||
frequency | ||
Return a fixed frequency DatetimeIndex. | ||
|
||
The default frequency is day (calendar). | ||
|
||
Parameters | ||
---------- | ||
start : string or datetime-like, default None | ||
Left bound for generating dates | ||
Left bound for generating dates. | ||
end : string or datetime-like, default None | ||
Right bound for generating dates | ||
Right bound for generating dates. | ||
periods : integer, default None | ||
Number of periods to generate | ||
Number of periods to generate. | ||
freq : string or DateOffset, default 'D' (calendar daily) | ||
Frequency strings can have multiples, e.g. '5H' | ||
Frequency strings can have multiples, e.g. '5H'. | ||
tz : string, default None | ||
Time zone name for returning localized DatetimeIndex, for example | ||
Asia/Hong_Kong | ||
Asia/Hong_Kong. | ||
normalize : bool, default False | ||
Normalize start/end dates to midnight before generating date range | ||
Normalize start/end dates to midnight before generating date range. | ||
name : string, default None | ||
Name of the resulting DatetimeIndex | ||
Name of the resulting DatetimeIndex. | ||
closed : string, default None | ||
Make the interval closed with respect to the given frequency to | ||
the 'left', 'right', or both sides (None) | ||
the 'left', 'right', or both sides (None). | ||
|
||
Notes | ||
----- | ||
|
@@ -2237,6 +2238,22 @@ def date_range(start=None, end=None, periods=None, freq='D', tz=None, | |
Returns | ||
------- | ||
rng : DatetimeIndex | ||
|
||
See Also | ||
________ | ||
pandas.period_range : Return a fixed frequency PeriodIndex. | ||
pandas.interval_range : Return a fixed frequency IntervalIndex. | ||
|
||
Examples | ||
-------- | ||
>>> import pandas | ||
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. We assume that these imports are available import pandas as pd
import numpy as np so you can remove the import and do |
||
>>> pandas.date_range('20181003', periods=2) | ||
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. Can you do these in iso format 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. will do it 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. Done! |
||
DatetimeIndex(['2018-10-03', '2018-10-04'], dtype='datetime64[ns]', | ||
freq='D') | ||
|
||
>>> pandas.date_range(start='20180101', end='20180103') | ||
DatetimeIndex(['2018-01-01', '2018-01-02', '2018-01-03'], | ||
dtype='datetime64[ns]', freq='D') | ||
""" | ||
return DatetimeIndex(start=start, end=end, periods=periods, | ||
freq=freq, tz=tz, normalize=normalize, name=name, | ||
|
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.
Consider using
----
for consistencyThere 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.
Ohh silly mistake! thanks for figuring it out