diff options
Diffstat (limited to 'bjoern/videoanalyse/tab_switch.py')
-rw-r--r-- | bjoern/videoanalyse/tab_switch.py | 14 |
1 files changed, 3 insertions, 11 deletions
diff --git a/bjoern/videoanalyse/tab_switch.py b/bjoern/videoanalyse/tab_switch.py index 2efa647..a0bb5de 100644 --- a/bjoern/videoanalyse/tab_switch.py +++ b/bjoern/videoanalyse/tab_switch.py @@ -3,15 +3,7 @@ import pandas as pd -def tab_switches_per_type(df): - # url_types = ["url", "log_url", "longest", "most_frequent"] - # dist_types = [ - # "levenshtein-distance", - # "levenshtein-distance", - # "longest-distance", - # "most_frequent-distance", - # ] - +def tab_switches_per_type(df, key_column): result = { "vp_code": [], "log_url": [], @@ -26,7 +18,7 @@ def tab_switches_per_type(df): count = -1 for row in df.iterrows(): row = row[1] - if row["group_index"] != last_group: + if row[key_column] != last_group: result["vp_code"].append(row["vp_code"]) result["group"].append(row["group_index"]) result["log_url"].append(row["log_url"]) @@ -35,7 +27,7 @@ def tab_switches_per_type(df): result["most_frequent_url"].append(row["most_frequent"]) result["most_frequent-distance"].append(row["most_frequent-distance"]) - last_group = row["group_index"] + last_group = row[key_column] if count == -1: count = 1 continue |