From 43c9a5d54635c36352c014e92907d2693cfd5e3e Mon Sep 17 00:00:00 2001 From: Gustav Rasmussen Date: Sun, 6 Oct 2024 19:09:16 +0200 Subject: [PATCH] fix: type hint in txt_to_df --- src/helpers/analyze_stats.py | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/src/helpers/analyze_stats.py b/src/helpers/analyze_stats.py index dcfa3487..39b5c43a 100644 --- a/src/helpers/analyze_stats.py +++ b/src/helpers/analyze_stats.py @@ -33,10 +33,9 @@ def txt_to_df(infile: str) -> pd.DataFrame: lines = rf.readlines() lines = [line.removesuffix("\n") for line in lines] header = lines[6].split() - data = lines[7:] - # print(header, data[0]) - # Split the data into columns and clean up - data = [line.split() for line in data] + + data: list[list[str]] = [line.split() for line in lines[7:]] + data = [d for d in data if len(d) == len(header)] # Ensure data aligns with header length # Convert to DataFrame df = pd.DataFrame(data=data, columns=header)