pandas.PeriodIndex.to_timestamp#

PeriodIndex.to_timestamp(freq=None, how='start')[source] #

Cast to DatetimeArray/Index.

Parameters:
freqstr or DateOffset, optional

Target frequency. The default is ‘D’ for week or longer, ‘s’ otherwise.

how{‘s’, ‘e’, ‘start’, ‘end’}

Whether to use the start or end of the time period being converted.

Returns:
DatetimeArray/Index

Examples

>>> idx = pd.PeriodIndex(["2023-01", "2023-02", "2023-03"], freq="M")
>>> idx.to_timestamp()
DatetimeIndex(['2023年01月01日', '2023年02月01日', '2023年03月01日'],
dtype='datetime64[ns]', freq='MS')