Skip to content

Commit f858c55

Browse files
Merge pull request #35 from Satvik-Singh192/feat-standardize-date
feat: implemented date standardization in transform
2 parents d8a7a23 + 9ebd571 commit f858c55

File tree

1 file changed

+9
-2
lines changed

1 file changed

+9
-2
lines changed

app/etl/transform.py

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -45,8 +45,15 @@ def transform(df: pd.DataFrame) -> pd.DataFrame:
4545
if any(keyword in col.lower() for keyword in ['date', 'time', 'created', 'updated'])]
4646

4747
for col in date_columns:
48-
# TODO (Find & Fix): Date columns are not standardized
49-
pass
48+
try:
49+
df_transformed[col] = pd.to_datetime(df_transformed[col], errors='coerce', infer_datetime_format=True)
50+
# Standardize all dates to 'YYYY-MM-DD HH:MM:SS'
51+
df_transformed[col] = df_transformed[col].dt.strftime('%Y-%m-%d %H:%M:%S')
52+
53+
print(f"✅ Standardized date column '{col}' (e.g., {df_transformed[col].iloc[0]})")
54+
except Exception as e:
55+
print(f"⚠️ Could not standardize column '{col}': {e}")
56+
5057

5158
# TODO (Find & Fix): Text columns are not cleaned (strip, lowercase)
5259
return df_transformed

0 commit comments

Comments
 (0)