REF: re-use existing conversion functions
Yep exactly. Makes sense for future plan

Sent from my iPhone

> On Jun 7, 2020, at 9:46 AM, jbrockmendel <notifications@github.com> wrote:
> 
> ﻿
> @jbrockmendel commented on this pull request.
> 
> In pandas/_libs/tslibs/period.pyx:
> 
> >          return DtoB(dts, 0, unix_date)
>  
> -    elif freq_group == FR_WK:
> -        return unix_date_to_week(unix_date, freq - FR_WK)
> +    unit = get_unit(freq)
> +    return npy_datetimestruct_to_datetime(unit, dts)
> +
> +
> +cdef NPY_DATETIMEUNIT get_unit(int freq) nogil:
> I think what you're suggesting is something like:
> 
> cdef enum FreqGroup:
>     FR_MTH = NPY_DATETIMEUNIT.NPY_FR_M
>     FR_DAY = NPY_DATETIMEUNIT.NPY_FR_D
>     [...]
> LMK if you have something else in mind.
> 
> The trouble with that is that we currently actually use the values for FR_FOO directly, and this would change those.
> 
> There are a bunch of near-duplicate enum-like codes floating around that i do want to de-duplicate. #34588 makes FreqGroup an enum, and after #34587 im hoping we can de-duplicate FreqGroup with Resolution.
> 
> —
> You are receiving this because you commented.
> Reply to this email directly, view it on GitHub, or unsubscribe.
