Skip to content

PeriodIndex annotation is missing a bunch of fields #395

Closed
@gandhis1

Description

@gandhis1

https://github.com/pandas-dev/pandas-stubs/blob/main/pandas-stubs/core/indexes/period.pyi#L20

Missing these attributes, per https://pandas.pydata.org/docs/reference/api/pandas.PeriodIndex.html:

attribute description
day The days of the period.
dayofweek The day of the week with Monday=0, Sunday=6.
day_of_week The day of the week with Monday=0, Sunday=6.
dayofyear The ordinal day of the year.
day_of_year The ordinal day of the year.
days_in_month The number of days in the month.
daysinmonth The number of days in the month.
end_time Get the Timestamp for the end of the period.
freq Return the frequency object if it is set, otherwise None.
freqstr Return the frequency object as a string if its set, otherwise None.
hour The hour of the period.
is_leap_year Logical indicating if the date belongs to a leap year.
minute The minute of the period.
month The month as January=1, December=12.
quarter The quarter of the date.
second The second of the period.
start_time Get the Timestamp for the start of the period.
week The week ordinal of the year.
weekday The day of the week with Monday=0, Sunday=6.
weekofyear The week ordinal of the year.
year The year of the period.

And these methods:

method description
asfreq([freq, how]) Convert the PeriodArray to the specified frequency freq.
strftime(*args, **kwargs) Convert to Index using specified date_format.
to_timestamp([freq, how]) Cast to DatetimeArray/Index.

Example error:

error: "PeriodIndex" has no attribute "start_time"

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions