@@ -1913,17 +1913,18 @@ cdef class _Period(PeriodMixin):
1913
1913
Parameters
1914
1914
----------
1915
1915
freq : str , BaseOffset
1916
- The target frequency to convert the Period object to. If a string is provided ,
1916
+ The target frequency to convert the Period object to.
1917
+ If a string is provided ,
1917
1918
it must be a valid :ref:`period alias <timeseries.period_aliases>`.
1918
1919
1919
1920
how : {'E', 'S', 'end', 'start'}, default 'end'
1920
- Specifies whether to align the converted period to the start or end of the interval:
1921
+ Specifies whether to align the period to the start or end of the interval:
1921
1922
- 'E' or 'end': Align to the end of the interval.
1922
1923
- 'S' or 'start': Align to the start of the interval.
1923
1924
1924
1925
Returns
1925
1926
-------
1926
- Resampled Period : A new Period object with the specified frequency , aligned according to the `how` parameter.
1927
+ Period : A new Period object with the specified frequency , aligned to the `how` parameter.
1927
1928
1928
1929
See Also
1929
1930
--------
@@ -1946,13 +1947,13 @@ cdef class _Period(PeriodMixin):
1946
1947
>>> period.asfreq('D', how = ' start' )
1947
1948
Period('2023-01-01', 'D')
1948
1949
1949
- Convert a yearly period to a monthly period , aligning to the last month of the year :
1950
+ Convert a yearly period to a monthly period , aligning to the last month:
1950
1951
1951
1952
>>> period = pd.Period(' 2023' , freq = ' Y' )
1952
1953
>>> period.asfreq('M', how = ' end' )
1953
1954
Period('2023-12', 'M')
1954
1955
1955
- Convert a monthly period to an hourly period , aligning to the start of the first day of the month:
1956
+ Convert a monthly period to an hourly period , aligning to the first day of the month:
1956
1957
1957
1958
>>> period = pd.Period(' 2023-01' , freq = ' M' )
1958
1959
>>> period.asfreq('h', how = ' start' )
@@ -2067,7 +2068,7 @@ cdef class _Period(PeriodMixin):
2067
2068
Notes
2068
2069
-----
2069
2070
The month is determined based on the `ordinal` and `base` attributes of the Period.
2070
-
2071
+
2071
2072
Examples
2072
2073
--------
2073
2074
Create a Period object for January 2022 and get the month:
@@ -2076,7 +2077,7 @@ cdef class _Period(PeriodMixin):
2076
2077
>>> period.month
2077
2078
1
2078
2079
2079
- Create a Period object with no specified frequency , resulting in a default frequency:
2080
+ Period object with no specified frequency , resulting in a default frequency:
2080
2081
2081
2082
>>> period = pd.Period(' 2022' , ' Y' )
2082
2083
>>> period.month
@@ -2088,7 +2089,7 @@ cdef class _Period(PeriodMixin):
2088
2089
>>> period.month
2089
2090
1
2090
2091
2091
- Handle a case where the Period object is invalid or empty , which results in `NaN`:
2092
+ Handle a case where the Period object is empty , which results in `NaN`:
2092
2093
2093
2094
>>> period = pd.Period(' nan' , ' M' )
2094
2095
>>> period.month
0 commit comments