Skip to content

Commit f52c610

Browse files
committed
Fix docstrings for pandas.Period.year SA01 Validate Docstrings err
1 parent cde723f commit f52c610

File tree

1 file changed

+6
-5
lines changed

1 file changed

+6
-5
lines changed

pandas/_libs/tslibs/period.pyx

+6-5
Original file line numberDiff line numberDiff line change
@@ -2044,7 +2044,7 @@ cdef class _Period(PeriodMixin):
20442044

20452045
See Also
20462046
--------
2047-
period.month : Get the month of the year on the given Period.
2047+
period.month : Get the month of the year for the given Period.
20482048
period.day : Return the day of the month the Period falls on.
20492049

20502050
Notes
@@ -2060,9 +2060,10 @@ cdef class _Period(PeriodMixin):
20602060
2023
20612061

20622062
Create a Period object for 01 January 2023 and get the year:
2063+
20632064
>>> period = pd.Period('2023', 'D')
2064-
        >>> period.year
2065-
        2023
2065+
>>> period.year
2066+
2023
20662067

20672068
Get the year for a period representing a quarter:
20682069

@@ -2073,13 +2074,13 @@ cdef class _Period(PeriodMixin):
20732074
Handle a case where the Period object is empty, which results in `NaN`:
20742075

20752076
>>> period = pd.Period('nan', 'M')
2076-
>>> period.month
2077+
>>> period.year
20772078
nan
20782079

20792080
Period object with an invalid format:
20802081

20812082
>>> period = pd.Period('invalid', 'M')
2082-
# Will raise an DateParseError
2083+
# Will raise a DateParseError
20832084
"""
20842085
base = self._dtype._dtype_code
20852086
return pyear(self.ordinal, base)

0 commit comments

Comments
 (0)