def _get_range(self, dim, start, end):
        """Create a :class:`Range` for the :class:`Chart`.

        Args:
            dim (str): the name of the dimension, which is an attribute of the builder
            start: the starting value of the range
            end: the ending value of the range

        Returns:
            :class:`Range`
        """
        dim_ref = getattr(self, dim)
        values = dim_ref.data
        dtype = dim_ref.dtype.name

        sort = self.sort_dim.get(dim)

        # object data or single value
        if dtype == 'object':
            factors = values.drop_duplicates()
            if sort:
                # TODO (fpliger):   this handles pandas API change so users do not experience
                #                   the related annoying deprecation warning. This is probably worth
                #                   removing when pandas deprecated version (0.16) is "old" enough
                try:
                    factors.sort_values(inplace=True)
                except __HOLE__:
                    factors.sort(inplace=True)

            setattr(self, dim + 'scale', 'categorical')
            return FactorRange(factors=factors.tolist())
        elif 'datetime' in dtype:
            setattr(self, dim + 'scale', 'datetime')
            return Range1d(start=start, end=end)
        else:

            if end == 'None' or (end - start) == 0:
                setattr(self, dim + 'scale', 'categorical')
                return FactorRange(factors=['None'])
            else:
                diff = end - start
                setattr(self, dim + 'scale', 'linear')
                return Range1d(start=start - 0.1 * diff, end=end + 0.1 * diff)
dataset/ETHPy150Open bokeh/bokeh/bokeh/charts/builder.py/XYBuilder._get_range