original_docstring: 
          Split the trajectory into subtrajectories whenever there is a gap in the observations.
  
          Parameters
          ----------
          gap : datetime.timedelta
              Time gap threshold
  
          Returns
          -------
          list
              List of trajectories
          
docstring: Split the trajectory into subtrajectories whenever there is a gap in the observations.
  Parameters
  
  gap : datetime.timedelta
  Time gap threshold
  
  Returns
  
  list
  List of trajectories
docstring_tokens: Split the trajectory into subtrajectories whenever there is a gap in the observations . Parameters gap : datetime . timedelta Time gap threshold Returns list List of trajectories
code: def split_by_observation_gap(self, gap):
          """
          Split the trajectory into subtrajectories whenever there is a gap in the observations.
  
          Parameters
          ----------
          gap : datetime.timedelta
              Time gap threshold
  
          Returns
          -------
          list
              List of trajectories
          """
          result = []
          temp_df = self.df.copy()
          temp_df['t'] = temp_df.index
          temp_df['gap'] = temp_df['t'].diff() > gap
          temp_df['gap'] = temp_df['gap'].apply(lambda x: 1 if x else 0).cumsum()
          dfs = [group[1] for group in temp_df.groupby(temp_df['gap'])]
          for i, df in enumerate(dfs):
              df = df.drop(columns=['t', 'gap'])
              if len(df) > 1:
                  result.append(Trajectory(df, '{}_{}'.format(self.id, i)))
          return result
code_tokens: def split_by_observation_gap ( self , gap ) : result = [ ] temp_df = self . df . copy ( ) temp_df [ 't' ] = temp_df . index temp_df [ 'gap' ] = temp_df [ 't' ] . diff ( ) > gap temp_df [ 'gap' ] = temp_df [ 'gap' ] . apply ( lambda x : 1 if x else 0 ) . cumsum ( ) dfs = [ group [ 1 ] for group in temp_df . groupby ( temp_df [ 'gap' ] ) ] for i , df in enumerate ( dfs ) : df = df . drop ( columns = [ 't' , 'gap' ] ) if len ( df ) > 1 : result . append ( Trajectory ( df , '{}_{}' . format ( self . id , i ) ) ) return result
short_docstring: Split the trajectory into subtrajectories whenever there is a gap in the observations.
short_docstring_tokens: Split the trajectory into subtrajectories whenever there is a gap in the observations .
comment: """
          Split the trajectory into subtrajectories whenever there is a gap in the observations.
  
          Parameters
          ----------
          gap : datetime.timedelta
              Time gap threshold
  
          Returns
          -------
          list
              List of trajectories
          """