pandas 1.4.2

ParametersReturnsBackRef
asfreq(self, freq=None, how: 'str' = 'E') -> 'PeriodIndex'

Equivalent to applying pandas.Period.asfreq with the given arguments to each ~pandas.Period in this PeriodArray.

Parameters

freq : str

A frequency.

how : str {'E', 'S'}, default 'E'

Whether the elements should be aligned to the end or start within pa period.

  • 'E', 'END', or 'FINISH' for end,

  • 'S', 'START', or 'BEGIN' for start.

January 31st ('END') vs. January 1st ('START') for example.

Returns

PeriodArray

The transformed PeriodArray with the new frequency.

Convert the PeriodArray to the specified frequency :None:None:`freq`.

See Also

Period.asfreq

Convert a :None:class:`~pandas.Period` object to the given frequency.

pandas.arrays.PeriodArray.asfreq

Convert each Period in a PeriodArray to the given frequency.

Examples

This example is valid syntax, but we were not able to check execution
>>> pidx = pd.period_range('2010-01-01', '2015-01-01', freq='A')
... pidx PeriodIndex(['2010', '2011', '2012', '2013', '2014', '2015'], dtype='period[A-DEC]')
This example is valid syntax, but we were not able to check execution
>>> pidx.asfreq('M')
PeriodIndex(['2010-12', '2011-12', '2012-12', '2013-12', '2014-12',
'2015-12'], dtype='period[M]')
This example is valid syntax, but we were not able to check execution
>>> pidx.asfreq('M', how='S')
PeriodIndex(['2010-01', '2011-01', '2012-01', '2013-01', '2014-01',
'2015-01'], dtype='period[M]')
See :

Back References

The following pages refer to to this document either explicitly or contain code examples using this.

pandas.core.arrays.period.PeriodArray.asfreq

Local connectivity graph

Hover to see nodes names; edges to Self not shown, Caped at 50 nodes.

Using a canvas is more power efficient and can get hundred of nodes ; but does not allow hyperlinks; , arrows or text (beyond on hover)

SVG is more flexible but power hungry; and does not scale well to 50 + nodes.

All aboves nodes referred to, (or are referred from) current nodes; Edges from Self to other have been omitted (or all nodes would be connected to the central node "self" which is not useful). Nodes are colored by the library they belong to, and scaled with the number of references pointing them


File: /pandas/core/indexes/period.py#165
type: <class 'function'>
Commit: