microsoft/qlib · error · ValueError
freq format is not supported, the freq should be like (n)mon
Error message
freq format is not supported, the freq should be like (n)month/mon, (n)week/w, (n)day/d, (n)minute/min
What it means
Error "freq format is not supported, the freq should be like (n)month/mon, (n)week/w, (n)day/d, (n)minute/min" thrown in microsoft/qlib.
Source
Thrown at qlib/utils/time.py:169
-------
freq: Tuple[int, str]
Unified freq, including freq count and unified freq unit. The freq unit should be '[month|week|day|minute]'.
Example:
.. code-block::
print(Freq.parse("day"))
(1, "day" )
print(Freq.parse("2mon"))
(2, "month")
print(Freq.parse("10w"))
(10, "week")
"""
freq = freq.lower()
match_obj = re.match("^([0-9]*)(month|mon|week|w|day|d|minute|min)$", freq)
if match_obj is None:
raise ValueError(
"freq format is not supported, the freq should be like (n)month/mon, (n)week/w, (n)day/d, (n)minute/min"
)
_count = int(match_obj.group(1)) if match_obj.group(1) else 1
_freq = match_obj.group(2)
_freq_format_dict = {
"month": Freq.NORM_FREQ_MONTH,
"mon": Freq.NORM_FREQ_MONTH,
"week": Freq.NORM_FREQ_WEEK,
"w": Freq.NORM_FREQ_WEEK,
"day": Freq.NORM_FREQ_DAY,
"d": Freq.NORM_FREQ_DAY,
"minute": Freq.NORM_FREQ_MINUTE,
"min": Freq.NORM_FREQ_MINUTE,
}
return _count, _freq_format_dict[_freq]
@staticmethod
def get_timedelta(n: int, freq: str) -> pd.Timedelta:View on GitHub (pinned to 79633dd950)
Solutions
- Use a freq string like (n)month/mon, (n)week/w, (n)day/d, or (n)minute/min, e.g. '1day', '5min'.
- Fix the freq format in your config or call to match the supported pattern.
When it happens
Trigger: This error is raised at qlib/utils/time.py:169 when the guard condition fails: "freq format is not supported". It triggers when the code path receives input or a state that violates the precondition checked at this point — e.g. an unimplemented abstract method being called, an unsupported argument type/value, or an invalid configuration. To avoid it, satisfy the documented precondition before this call: implement the required method in your subclass, or pass a supported value of the expected type as described by the message.
Common situations: See trigger scenarios.
AI-assisted analysis of microsoft/qlib@79633dd950 (2026-08-15).
Data as JSON: /api/errors/f3af2308c3b1a0b5.
Report an issue: GitHub.