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

DOC: update the pandas.date_range() docstring #20143

Merged
merged 6 commits into from
Mar 11, 2018
Merged
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
36 changes: 26 additions & 10 deletions pandas/core/indexes/datetimes.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
-----
Expand All @@ -2237,6 +2238,21 @@ def date_range(start=None, end=None, periods=None, freq='D', tz=None,
Returns
-------
rng : DatetimeIndex

See Also
________
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Consider using ---- for consistency

Copy link
Contributor Author

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

pandas.period_range : Return a fixed frequency PeriodIndex.
pandas.interval_range : Return a fixed frequency IntervalIndex.

Examples
--------
>>> pd.date_range('2018-10-03', periods=2)
DatetimeIndex(['2018-10-03', '2018-10-04'], dtype='datetime64[ns]',
freq='D')

>>> pd.date_range(start='2018-01-01', 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,
Expand Down