Skip to content

DOCS: fix docstring validation error for pandas.Series #59655

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 4 commits into from
Closed
Show file tree
Hide file tree
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
1 change: 0 additions & 1 deletion ci/code_checks.sh
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,6 @@ if [[ -z "$CHECK" || "$CHECK" == "docstrings" ]]; then
-i "pandas.Series.dt.microseconds SA01" \
-i "pandas.Series.dt.month_name PR01,PR02" \
-i "pandas.Series.dt.nanoseconds SA01" \
-i "pandas.Series.dt.normalize PR01" \
-i "pandas.Series.dt.round PR01,PR02" \
-i "pandas.Series.dt.seconds SA01" \
-i "pandas.Series.dt.strftime PR01,PR02" \
Expand Down
56 changes: 55 additions & 1 deletion pandas/core/arrays/datetimes.py
Original file line number Diff line number Diff line change
Expand Up @@ -250,6 +250,7 @@ def _scalar_type(self) -> type[Timestamp]:
"dayofyear",
"day_of_year",
"quarter",
"qyear",
"days_in_month",
"daysinmonth",
"microsecond",
Expand Down Expand Up @@ -1141,7 +1142,7 @@ def to_pydatetime(self) -> npt.NDArray[np.object_]:
"""
return ints_to_pydatetime(self.asi8, tz=self.tz, reso=self._creso)

def normalize(self) -> Self:
def normalize(self, *args, **kwargs) -> Self:
Copy link
Member

Choose a reason for hiding this comment

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

There is no normalize numpy function as far as I know so this should not be included

"""
Convert times to midnight.

Expand All @@ -1152,6 +1153,15 @@ def normalize(self) -> Self:
This method is available on Series with datetime values under
the ``.dt`` accessor, and directly on Datetime Array/Index.

Parameters
----------
*args : any, default None
Additional keywords have no effect but might be accepted for
compatibility with NumPy.
**kwargs : any, default None
Additional keywords have no effect but might be accepted for
compatibility with NumPy.

Returns
-------
DatetimeArray, DatetimeIndex or Series
Expand Down Expand Up @@ -1919,6 +1929,50 @@ def isocalendar(self) -> DataFrame:
Index([1, 1], dtype='int32')
""",
)
qyear = _field_accessor(
"qyear",
"qy",
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
"qy",
"qyear",

"qy" is not a valid field.

"""
Fiscal year the Period lies in according to its starting-quarter.

The `year` and the `qyear` of the period will be the same if the fiscal
and calendar years are the same. When they are not, the fiscal year
can be different from the calendar year of the period.

Returns
-------
int
The fiscal year of the period.

See Also
--------
DatetimeIndex.year : Return the calendar year of the date.
DatetimeIndex.quarter : Return the quarter of the date.

Examples
--------
If the natural and fiscal year are the same, `qyear` and `year` will
be the same.

>>> per = pd.Period('2018Q1', freq='Q')
>>> per.qyear
2018
>>> per.year
2018

If the fiscal year starts in April (`Q-MAR`), the first quarter of
2018 will start in April 2017. `year` will then be 2017, but `qyear`
will be the fiscal year, 2018.

>>> per = pd.Period('2018Q1', freq='Q-MAR')
>>> per.start_time
Timestamp('2017-04-01 00:00:00')
>>> per.qyear
2018
>>> per.year
2017
""",
)
days_in_month = _field_accessor(
"days_in_month",
"dim",
Expand Down
Loading