Skip to content

Commit 70379e8

Browse files
committed
Quick fix. New M => ME broke a custom MonthEnd subclass due to freqstr
and __hash__. Unsure if I'm just using things "incorrectly"
1 parent b786ce9 commit 70379e8

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

pandas/_libs/tslibs/period.pyx

+5-1
Original file line numberDiff line numberDiff line change
@@ -2479,7 +2479,11 @@ cdef class _Period(PeriodMixin):
24792479
>>> pd.Period('2020-01', 'D').freqstr
24802480
'D'
24812481
"""
2482-
freqstr = freq_to_period_freqstr(self.freq.n, self.freq.name)
2482+
# I have a custom MonthEnd subclass that I need to be hash compatible with MonthEnd.
2483+
name = self.freq.name
2484+
if name == 'STC-M':
2485+
name = 'ME'
2486+
freqstr = freq_to_period_freqstr(self.freq.n, name)
24832487
return freqstr
24842488

24852489
def __repr__(self) -> str:

0 commit comments

Comments
 (0)