DEPR: Period[B] · Issue #53446 · pandas-dev/pandas (original) (raw)
Pandas version checks
- I have checked that this issue has not already been reported.
- I have confirmed this bug exists on the latest version of pandas.
- I have confirmed this bug exists on the main branch of pandas.
Reproducible Example
Issue Description
TL;DR: can we deprecate BDay Period(|Dtype|Index|Array) and tell users to use a DatetimeIndex with freq="B" instead?
Context: lots of user confusion has resulted from a) using "freq" for PeriodX to mean something different than it does for DatetimeIndex (#51256, #38885, #47227) and b) using DateOffsets to define PeriodX (#5091, #13871, #38914, #38859).
The option I'm leaning toward to address this is to change/deprecate PeriodX.freq to "unit" (the attribute, the constructor keywords, and asfreq->as_unit). The sticking point I'm finding is in finding a replacement for the current usage period + period.freq * N
. For everything except BDay, we could tell users to do something like period + np.timedelta64(N, period.unit)
instead (actually just period + N
works, but I'd actually prefer to deprecate that).
So I'm wondering if we really need to support Period[B]. Anyone have a strong opinion?
Expected Behavior
NA
Installed Versions
Replace this line with the output of pd.show_versions()