Skip to content

Commit

Permalink
fix: type hint in txt_to_df
Browse files Browse the repository at this point in the history
  • Loading branch information
TheNewThinkTank committed Oct 6, 2024
1 parent c3f32d5 commit 43c9a5d
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions src/helpers/analyze_stats.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down

0 comments on commit 43c9a5d

Please sign in to comment.