Skip to content

Commit

Permalink
Update validate_csv.py
Browse files Browse the repository at this point in the history
  • Loading branch information
BaptisteVandecrux committed Sep 10, 2024
1 parent 513b174 commit 57ce5fb
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions validate_csv.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,10 @@ def validate_csv(file_path):

# Validate t0 and t1 columns for correct format
for index, row in df.iterrows():
if not is_iso8601(str(row['t0'])) or not is_iso8601(str(row['t1'])):
return False, f"Invalid t0/t1 timestamp format in file {file_path} at row {index + 1}"

if str(row['t0']).strip() != '' and not is_iso8601(str(row['t0'])):
return False, f"Invalid t0 timestamp format in file {file_path} at row {index + 1}"
if str(row['t1']).strip() != '' and not is_iso8601(str(row['t1'])):
return False, f"Invalid t1 timestamp format in file {file_path} at row {index + 1}"
return True, "Valid CSV file."

def validate_folder(folder_path):
Expand Down

0 comments on commit 57ce5fb

Please sign in to comment.