pandas.PeriodIndex.from_fields
pandas 3.1.1 · Index objects · method
Build a PeriodIndex from date fields such as years and quarters.
Call syntax
PeriodIndex.from_fields(…) Full signature
PeriodIndex.from_fields(
*,
year=None,
quarter=None,
month=None,
day=None,
hour=None,
minute=None,
second=None,
freq=None,
)Run the example
Edit the example and select Run Python to see the result.
Parameters
| Parameter | Requirement | Accepted values and behavior |
|---|---|---|
year |
Optional Keyword only Default None |
int or list-like Provide the calendar or period year. |
quarter |
Optional Keyword only Default None |
int or list-like |
month |
Optional Keyword only Default None |
int or list-like Provide the calendar month. |
day |
Optional Keyword only Default None |
int or list-like Provide the day of the month or documented day field. |
hour |
Optional Keyword only Default None |
int or list-like Provide the hour of the day. |
minute |
Optional Keyword only Default None |
int or list-like Provide the minute of the hour. |
second |
Optional Keyword only Default None |
int or list-like Provide the second of the minute. |
freq |
Optional Keyword only Default None |
str or period object Specify the frequency or offset, such as "D" for a day or "MS" for a calendar month start. |
Returns
PeriodIndex