Skip to content

DOC: update the pandas.Series.dt.is_month_start docstring #20146

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

Closed
wants to merge 5 commits into from
Closed
Changes from 2 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
27 changes: 26 additions & 1 deletion pandas/core/indexes/datetimes.py
Original file line number Diff line number Diff line change
Expand Up @@ -1727,7 +1727,32 @@ def freq(self, value):
is_month_start = _field_accessor(
'is_month_start',
'is_month_start',
"Logical indicating if first day of month (defined by frequency)")
"""
Return a boolean indicating if the date is the first day of the month.

Returns
-------
is_month_start : Series of boolean

See Also
--------
is_month_end : Returns a boolean indicating if the date is the last day of the month.

Examples
--------
>>> import pandas as pd
>>> dates = pd.Series(pd.date_range("2018-02-27", periods = 3))

Choose a reason for hiding this comment

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

PEP8 doesn't allow spaces around keyword parameters. i.e.: periods=3, instead of periods = 3

Choose a reason for hiding this comment

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

import pandas as pd is not necessary.

>>> dates
0 2018-02-27
1 2018-02-28
2 2018-03-01
dtype: datetime64[ns]
>>> dates.dt.is_month_start
0 False
1 False
2 True
dtype: bool
""")
is_month_end = _field_accessor(
'is_month_end',
'is_month_end',
Expand Down