Search code examples
pythonpandasdataframedatetimefrequency

What values are valid in Pandas 'Freq' tags?


I am trying to use date_range. I came across some values valid for freq, like BME and BMS and I would like to be able to quickly look up the proper strings to get what I want.

What values are valid in Pandas 'Freq' tags?


Solution

  • You can find it called Offset Aliases:

    A number of string aliases are given to useful common time series frequencies. We will refer to these aliases as offset aliases.

    Alias    Description
    B       business day frequency
    C       custom business day frequency
    D       calendar day frequency
    W       weekly frequency
    ME      month end frequency
    SME     semi-month end frequency (15th and end of month)
    BME     business month end frequency
    CBME    custom business month end frequency
    MS      month start frequency
    SMS     semi-month start frequency (1st and 15th)
    BMS     business month start frequency
    CBMS    custom business month start frequency
    QE      quarter end frequency
    BQE     business quarter end frequency
    QS      quarter start frequency
    BQS     business quarter start frequency
    YE      year end frequency
    BYE     business year end frequency
    YS      year start frequency
    BYS     business year start frequency
    h       hourly frequency
    bh      business hour frequency
    cbh     custom business hour frequency
    min     minutely frequency
    s       secondly frequency
    ms      milliseconds
    us      microseconds
    ns      nanoseconds