pandas.PeriodIndex.to_timestamp — pandas 2.2.3 documentation (original) (raw)
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')