Skip to content

Dtype attributes (eg PeriodDtype.freq) should not be settable #26096

Closed
@jorisvandenbossche

Description

@jorisvandenbossche

You can currently do this:

In [2]: pdt = pd.PeriodDtype(freq='D')

In [3]: pdt
Out[3]: period[D]

In [4]: pdt.freq = 'F'  

In [5]: pdt  
...
AttributeError: 'str' object has no attribute 'freqstr'

I think in general it would be good to make those dtype specific attributes not settable (this is already the case for DatetimeTZDtype.unit/tz, but not yet for the above case of PeriodDtype, and also not eg for IntervalDtype.subtype).

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions