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: Updated docstrings related to DateTimeIndex. GH22459 #22504

Merged
merged 3 commits into from
Nov 4, 2018
Merged
Changes from all 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: 24 additions & 12 deletions pandas/core/indexes/datetimes.py
Original file line number Diff line number Diff line change
Expand Up @@ -1413,7 +1413,8 @@ def date_range(start=None, end=None, periods=None, freq=None, tz=None,

>>> pd.date_range(start='2018-04-24', end='2018-04-27', periods=3)
DatetimeIndex(['2018-04-24 00:00:00', '2018-04-25 12:00:00',
'2018-04-27 00:00:00'], freq=None)
'2018-04-27 00:00:00'],
dtype='datetime64[ns]', freq=None)

**Other Parameters**

Expand Down Expand Up @@ -1484,37 +1485,39 @@ def bdate_range(start=None, end=None, periods=None, freq='B', tz=None,
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 'B' (business daily)
Frequency strings can have multiples, e.g. '5H'
Frequency strings can have multiples, e.g. '5H'.
tz : string or None
Time zone name for returning localized DatetimeIndex, for example
Asia/Beijing
Asia/Beijing.
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.
weekmask : string or None, default None
Weekmask of valid business days, passed to ``numpy.busdaycalendar``,
only used when custom frequency strings are passed. The default
value None is equivalent to 'Mon Tue Wed Thu Fri'
value None is equivalent to 'Mon Tue Wed Thu Fri'.

.. versionadded:: 0.21.0

holidays : list-like or None, default None
Dates to exclude from the set of valid business days, passed to
``numpy.busdaycalendar``, only used when custom frequency strings
are passed
are passed.

.. versionadded:: 0.21.0

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).
**kwargs
For compatibility. Has no effect on the result.
Copy link
Member

Choose a reason for hiding this comment

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

Not sure we need to document **kwargs?

cc @WillAyd @datapythonista

Copy link
Member

Choose a reason for hiding this comment

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

Yes, we've been documenting them, even when we need to say that they don't have any effect. Explicit is better than implicit. :)


Notes
-----
Expand All @@ -1528,7 +1531,16 @@ def bdate_range(start=None, end=None, periods=None, freq='B', tz=None,

Returns
-------
rng : DatetimeIndex
DatetimeIndex

Examples
--------
Note how the two weekend days are skipped in the result.

>>> pd.bdate_range(start='1/1/2018', end='1/08/2018')
DatetimeIndex(['2018-01-01', '2018-01-02', '2018-01-03', '2018-01-04',
'2018-01-05', '2018-01-08'],
dtype='datetime64[ns]', freq='B')
Copy link
Member

Choose a reason for hiding this comment

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

Hmmm...that output formatting of the lines is a little weird there. Should they be more aligned?

"""
if freq is None:
msg = 'freq must be specified for bdate_range; use date_range instead'
Expand Down