pandas.Period.now#
- classmethod Period.now(freq)#
Return the period of now’s date.
The now method provides a convenient way to generate a period object for the current date and time. This can be particularly useful in financial and economic analysis, where data is often collected and analyzed in regular intervals (e.g., hourly, daily, monthly). By specifying the frequency, users can create periods that match the granularity of their data.
- Parameters:
- freqstr, DateOffset
Frequency to use for the returned period.
See also
to_datetimeConvert argument to datetime.
PeriodRepresents a period of time.
Period.to_timestampReturn the Timestamp representation of the Period.
Examples
>>> pd.Period.now('h') Period('2023-06-12 11:00', 'h')