Distance

path(df=None, traces=None)

Calculate the path length for the given DataFrame. This function computes the path length based on the Euclidean distance between consecutive points.

Parameters:
  • df (pd.DataFrame) – DataFrame containing ‘x’ and ‘y’ columns.

  • traces (dict) – A dictionary with keys as (sessionId) and values as lists of DataFrames. If None, traces will be computed from df.

Returns:

DataFrame with an additional ‘distance’ column representing the path length.

Return type:

pd.DataFrame