traffic/core/flight.py
def between(
        self, start: timelike, stop: time_or_delta, strict: bool = True
    ) -> Optional["Flight"]:
        """Returns the part of the trajectory flown between start and stop.

        - ``start`` and ``stop`` can be passed as a string, an epoch, a Python
          datetime, or a Pandas timestamp.
        - ``stop`` can also be passed as a timedelta.

        """

        # Corner cases when start or stop are None or NaT
        if start is None or start != start:
            return self.before(stop, strict=strict)

        if stop is None or stop != stop:
            return self.after(start, strict=strict)

        start = to_datetime(start)
        if isinstance(stop, timedelta):
            stop = start + stop
        else:
            stop = to_datetime(stop)

        # full call is necessary to keep @start and @stop as local variables
        # return self.query('@start < timestamp < @stop')  => not valid
        if strict:
            df = self.data.query("@start < timestamp < @stop")
        else:
            df = self.data.query("@start <= timestamp <= @stop")

        if df.shape[0] == 0:
            return None

        return self.__class__(df)
Returns the part of the trajectory flown between start and stop.

        - ``start`` and ``stop`` can be passed as a string, an epoch, a Python
          datetime, or a Pandas timestamp.
        - ``stop`` can also be passed as a timedelta.

        
Returns the part of the trajectory flown between start and stop.
Returns the part of the trajectory flown between start and stop .
def between(
        self, start: timelike, stop: time_or_delta, strict: bool = True
    ) -> Optional["Flight"]:
        if start is None or start != start:
            return self.before(stop, strict=strict)
        if stop is None or stop != stop:
            return self.after(start, strict=strict)
        start = to_datetime(start)
        if isinstance(stop, timedelta):
            stop = start + stop
        else:
            stop = to_datetime(stop)
        if strict:
            df = self.data.query("@start < timestamp < @stop")
        else:
            df = self.data.query("@start <= timestamp <= @stop")
        if df.shape[0] == 0:
            return None
        return self.__class__(df)
def between ( self , start : timelike , stop : time_or_delta , strict : bool = True ) -> Optional [ "Flight" ] : if start is None or start != start : return self . before ( stop , strict = strict ) if stop is None or stop != stop : return self . after ( start , strict = strict ) start = to_datetime ( start ) if isinstance ( stop , timedelta ) : stop = start + stop else : stop = to_datetime ( stop ) if strict : df = self . data . query ( "@start < timestamp < @stop" ) else : df = self . data . query ( "@start <= timestamp <= @stop" ) if df . shape [ 0 ] == 0 : return None return self . __class__ ( df )
Returns the part of the trajectory flown between start and stop.
Returns the part of the trajectory flown between start and stop .
"""Returns the part of the trajectory flown between start and stop.

        - ``start`` and ``stop`` can be passed as a string, an epoch, a Python
          datetime, or a Pandas timestamp.
        - ``stop`` can also be passed as a timedelta.

        """ # Corner cases when start or stop are None or NaT # full call is necessary to keep @start and @stop as local variables # return self.query('@start < timestamp < @stop')  => not valid
self
start
timelike
stop
time_or_delta
strict
bool