Backport PR #38120: API: preserve freq in DTI/TDI.factorize
Backport PR #38120
@jbrockmendel if you can give this a quick eyeball before I merge. several merge conflicts where I could have gone wrong. see also comments in #38137  taking a look now The PeriodArray thing looks unnecessary but harmless, otherwise LGTM > The PeriodArray thing looks unnecessary but harmless, otherwise LGTM

see https://github.com/pandas-dev/pandas/pull/38137#issuecomment-735395004 makes sense, thanks