I was wondering is there any idea about how to do resampling on DateTime indices other than DatetimeIndex, TimedeltaIndex or PeriodIndex?
from datetime import timedelta
from khayyam import JalaliDate, JalaliDatetime
import pandas as pd
start_date_jalali = JalaliDate(1399, 5, 1)
end_date_jalali = JalaliDate(1400, 5, 31)
date = [start_date_jalali + timedelta(days=i) for i in range((end_date_jalali - start_date_jalali).days + 1)]
df = pd.DataFrame(index=date, columns=[])
df.index.name = 'Date'
df.resample('M')
TypeError: Only valid with DatetimeIndex, TimedeltaIndex or PeriodIndex, but got an instance of 'Index'
I think a simple workaround is to convert Jalali dates to Georgian dates and then apply resampling on them where the end of each period in Georgian must be the last day of the month in the Jalali calendar, as implemneted here.