Skip to content

Commit

Permalink
Merge pull request #394 from ONSdigital/RDRP-1068_python_311_errors
Browse files Browse the repository at this point in the history
RDRP-1068_python_311_errors
  • Loading branch information
AnneONS authored Jan 7, 2025
2 parents 5699b74 + e963c69 commit 49a6805
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
2 changes: 1 addition & 1 deletion src/staging/staging_main.py
Original file line number Diff line number Diff line change
Expand Up @@ -216,7 +216,7 @@ def run_staging( # noqa: C901
backdata_path = staging_dict["backdata_path"]
rd_file_exists(backdata_path, raise_error=True)
backdata = rd_read_csv(backdata_path)
val.validate_data_with_schema(backdata_path, "./config/backdata_schema.toml")
val.validate_data_with_schema(backdata, "./config/backdata_schema.toml")

StagingMainLogger.info("Backdata File Loaded Successfully...")

Expand Down
3 changes: 2 additions & 1 deletion src/staging/validation.py
Original file line number Diff line number Diff line change
Expand Up @@ -156,7 +156,8 @@ def validate_data_with_schema(survey_df: pd.DataFrame, schema_path: str): # noq
" the data."
)
else:
survey_df[column] = survey_df[column].astype(dtypes_dict[column])
if survey_df[column].isna().all() is False:
survey_df[column] = survey_df[column].astype(dtypes_dict[column])
except Exception as e:
ValidationLogger.error(e)
ValidationLogger.info("Validation successful")
Expand Down

0 comments on commit 49a6805

Please sign in to comment.