def to_perioddelta(self, freq):
        return to_timedelta(self.asi8 - self.to_period(freq)
                            .to_timestamp().asi8)
Calcuates TimedeltaIndex of difference between index
dataset/ETHPy150Open pydata/pandas/pandas/tseries/index.py/DatetimeIndex.to_perioddelta