pandas
pandas copied to clipboard
CLN: replace unnecessary `freq_to_period_freqstr` with `PeriodDtype` constructor
xref #52064
replaced freq_to_period_freqstr()
with PeriodDtype(freq)._freqstr
in ValueError message in the definition of _shift_with_freq()
I replaced freq_to_period_freqstr
with PeriodDtype(obj)._freqstr / PeriodDtypeBase(obj._period_dtype_code, obj.n)._freqstr
. Now we don’t need the function freq_to_period_freqstr
, which is why I removed it.
One comment:
In pandas/core/arrays/period.py
in the definition of raise_on_incompatible
I added
with warnings.catch_warnings():
warnings.simplefilter("ignore")
because otherwise the test_maybe_convert_timedelta
(in pandas/tests/indexes/period/test_period.py
) fail.
@MarcoGorelli, could you please take a look at this PR?
Thanks @natmokval