File tree Expand file tree Collapse file tree 1 file changed +4
-7
lines changed Expand file tree Collapse file tree 1 file changed +4
-7
lines changed Original file line number Diff line number Diff line change @@ -34,19 +34,16 @@ def extract(path: str = "xyz.csv") -> ________: # TODO (Find & Fix)
3434 # TODO (Find & Fix)
3535 pass
3636 except UnicodeDecodeError :
37- # TODO (Find & Fix)
38- pass
37+ print (f"Failed to read with encoding '{ encoding } '" ) # Log the encoding that failed
3938
4039 if df is None :
41- # TODO (Find & Fix)
42- pass
40+ raise ValueError (f" Could not read CSV with tried encodings: { encodings } " )
4341
4442 # Validate data
4543 if df .empty :
46- # TODO (Find & Fix)
47- pass
44+ raise ValueError ("File contains no data" )
4845
49- print (f"✅ Extracted { len (df )} rows and { len (df .columns )} columns" ) # TODO (Find & Fix) : Use logging instead of print
46+ print (f"✅ Extracted { len (df )} rows and { len (df .columns )} columns" ) # TODO: Use logging instead of print
5047 return df
5148
5249 except pd .errors .EmptyDataError :
You can’t perform that action at this time.
0 commit comments