def distance(self, method='haversine'):
        """Calculate distances between locations in segments.

        Args:
            method (str): Method used to calculate distance

        Returns:
            list of list of float: Groups of distance between points in
                segments
        """
        distances = []
        for segment in self:
            if len(segment) < 2:
                distances.append([])
            else:
                distances.append(segment.distance(method))
        return distances
Calculate distances between locations in segments.

        Args:
            method (str): Method used to calculate distance

        Returns:
            list of list of float: Groups of distance between points in
                segments