def resample(self, rate, window='<STR_LIT>', ftype='<STR_LIT>', n=None):
if n is None and ftype == '<STR_LIT>':<EOL><INDENT>n = <NUM_LIT:8><EOL><DEDENT>elif n is None:<EOL><INDENT>n = <NUM_LIT><EOL><DEDENT>if isinstance(rate, units.Quantity):<EOL><INDENT>rate = rate.value<EOL><DEDENT>factor = (self.sample_rate.value / rate)<EOL>if numpy.isclose(factor, <NUM_LIT:1.>, rtol=<NUM_LIT>, atol=<NUM_LIT:0.>):<EOL><INDENT>warnings.warn(<EOL>"<STR_LIT>"<EOL>"<STR_LIT>"<EOL>"<STR_LIT>".format(self.sample_rate),<EOL>UserWarning,<EOL>)<EOL>return self<EOL><DEDENT>if factor.is_integer():<EOL><INDENT>if ftype == '<STR_LIT>':<EOL><INDENT>filt = signal.cheby1(n, <NUM_LIT>, <NUM_LIT>/factor, output='<STR_LIT>')<EOL><DEDENT>else:<EOL><INDENT>filt = signal.firwin(n+<NUM_LIT:1>, <NUM_LIT:1.>/factor, window=window)<EOL><DEDENT>return self.filter(filt, filtfilt=True)[::int(factor)]<EOL><DEDENT>else:<EOL><INDENT>nsamp = int(self.shape[<NUM_LIT:0>] * self.dx.value * rate)<EOL>new = signal.resample(self.value, nsamp,<EOL>window=window).view(self.__class__)<EOL>new.__metadata_finalize__(self)<EOL>new._unit = self.unit<EOL>new.sample_rate = rate<EOL>return new<EOL><DEDENT>
Resample this Series to a new rate

        Parameters
        ----------
        rate : `float`
            rate to which to resample this `Series`

        window : `str`, `numpy.ndarray`, optional
            window function to apply to signal in the Fourier domain,
            see :func:`scipy.signal.get_window` for details on acceptable
            formats, only used for `ftype='fir'` or irregular downsampling

        ftype : `str`, optional
            type of filter, either 'fir' or 'iir', defaults to 'fir'

        n : `int`, optional
            if `ftype='fir'` the number of taps in the filter, otherwise
            the order of the Chebyshev type I IIR filter

        Returns
        -------
        Series
            a new Series with the resampling applied, and the same
            metadata