MCPcopy
hub / github.com/pandas-dev/pandas / _maybe_coerce_freq

Function _maybe_coerce_freq

pandas/tseries/frequencies.py:568–587  ·  view source on GitHub ↗

we might need to coerce a code to a rule_code and uppercase it Parameters ---------- source : str or DateOffset Frequency converting from Returns ------- str

(code)

Source from the content-addressed store, hash-verified

566
567
568def _maybe_coerce_freq(code) -> str:
569 """we might need to coerce a code to a rule_code
570 and uppercase it
571
572 Parameters
573 ----------
574 source : str or DateOffset
575 Frequency converting from
576
577 Returns
578 -------
579 str
580 """
581 assert code is not None
582 if isinstance(code, DateOffset):
583 code = PeriodDtype(to_offset(code.name))._freqstr
584 if code in {"h", "min", "s", "ms", "us", "ns"}:
585 return code
586 else:
587 return code.upper()
588
589
590def _quarter_months_conform(source: str, target: str) -> bool:

Callers 2

is_subperiodFunction · 0.85
is_superperiodFunction · 0.85

Calls 2

PeriodDtypeClass · 0.90
upperMethod · 0.80

Tested by

no test coverage detected