API: IncompatibleFrequency should subclass TypeError (original) (raw)

Pandas version checks

Reproducible Example

per1 = pd.Period("2016Q1", freq="Q") per2 = per1.asfreq("M")

per1 < per2 pandas._libs.tslibs.period.IncompatibleFrequency: Input has different freq=M from Period(freq=Q-DEC)

idx = pd.Index([per1, per2]) idx2 = pd.Index([per1, "foo"])

idx.is_monotonic_increasing pandas._libs.tslibs.period.IncompatibleFrequency: Input has different freq=Q-DEC from Period(freq=M)

idx2.is_monotonic_increasing False

Issue Description

In general the exception you get from mismatched comparisons should be a TypeError (xref #54847). ATM IncompatibleFrequency subclasses ValueError. Might be worth changing that in 3.0.

Expected Behavior

NA

Installed Versions

Replace this line with the output of pd.show_versions()