From 1afc307a16b1cdb2c05d0d1cbf8cdc78ecebf5f1 Mon Sep 17 00:00:00 2001 From: Shorouq Date: Thu, 17 Oct 2024 17:19:21 +0200 Subject: [PATCH] =?UTF-8?q?=E2=9C=A8=20Add=20data=20gap=20utils?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Database/scr/normalize_data.py | 14 ++++++++++++++ 1 file changed, 14 insertions(+) create mode 100644 Database/scr/normalize_data.py diff --git a/Database/scr/normalize_data.py b/Database/scr/normalize_data.py new file mode 100644 index 000000000..62adf91f0 --- /dev/null +++ b/Database/scr/normalize_data.py @@ -0,0 +1,14 @@ +from .log_utils import Logging + + +class DataGapUtils: + def __init__(self): + self.logger = Logging.get_logger("data-gap-utils") + + @staticmethod + def fill_date(row: dict, replace_with_date: dict): + date_cols = [x for x in row.keys() if "_Date_" in x] + if all([True if row[d] is None else False for d in date_cols]): + for c in date_cols: + row[c] = replace_with_date[c] + return row