pandas.Period.to_timestamp#

Period.to_timestamp(freq=None, how='start')#

返回 Period 的 Timestamp 表示。

使用由 how 指定的周期的该部分的目标频率,how 要么是 Start 要么是 Finish

Parameters:
freqstr 或 DateOffset

目标频率。如果 self.freq 为周或更长,则默认为 ‘D’,否则为 ‘S’。

howstr,默认为 ‘S’ (开始)

‘S’、’E’ 中的一个。可以作为不区分大小写的 ‘Start’、’Finish’、’Begin’、’End’ 的别名。

Returns:
Timestamp

Examples

>>> period = pd.Period('2023-1-1', freq='D')
>>> timestamp = period.to_timestamp()
>>> timestamp
Timestamp('2023-01-01 00:00:00')