def crop(self, start=None, end=None, copy=False):
x0, x1 = self.xspan<EOL>xtype = type(x0)<EOL>if isinstance(start, Quantity):<EOL><INDENT>start = start.to(self.xunit).value<EOL><DEDENT>if isinstance(end, Quantity):<EOL><INDENT>end = end.to(self.xunit).value<EOL><DEDENT>if start == x0:<EOL><INDENT>start = None<EOL><DEDENT>elif start is not None and xtype(start) < x0:<EOL><INDENT>warn('<STR_LIT>'<EOL>'<STR_LIT>'<EOL>% type(self).__name__)<EOL>start = None<EOL><DEDENT>if end == x1:<EOL><INDENT>end = None<EOL><DEDENT>if end is not None and xtype(end) > x1:<EOL><INDENT>warn('<STR_LIT>'<EOL>'<STR_LIT>'<EOL>% type(self).__name__)<EOL>end = None<EOL><DEDENT>if start is None:<EOL><INDENT>idx0 = None<EOL><DEDENT>else:<EOL><INDENT>idx0 = int((xtype(start) - x0) // self.dx.value)<EOL><DEDENT>if end is None:<EOL><INDENT>idx1 = None<EOL><DEDENT>else:<EOL><INDENT>idx1 = int((xtype(end) - x0) // self.dx.value)<EOL>if idx1 >= self.size:<EOL><INDENT>idx1 = None<EOL><DEDENT><DEDENT>if copy:<EOL><INDENT>return self[idx0:idx1].copy()<EOL><DEDENT>return self[idx0:idx1]<EOL>
Crop this series to the given x-axis extent.

        Parameters
        ----------
        start : `float`, optional
            lower limit of x-axis to crop to, defaults to
            current `~Series.x0`

        end : `float`, optional
            upper limit of x-axis to crop to, defaults to current series end

        copy : `bool`, optional, default: `False`
            copy the input data to fresh memory, otherwise return a view

        Returns
        -------
        series : `Series`
            A new series with a sub-set of the input data

        Notes
        -----
        If either ``start`` or ``end`` are outside of the original
        `Series` span, warnings will be printed and the limits will
        be restricted to the :attr:`~Series.xspan`