Let PeriodIndex infer frequency by converting first element to Period

Fix for #8466.