From d68a42ed932b1f7214069e4ebed8257f2c39ae29 Mon Sep 17 00:00:00 2001 From: Silcantar <1491897+Silcantar@users.noreply.github.com> Date: Mon, 14 Sep 2026 14:14:15 -0500 Subject: [PATCH] Add module for extending DataFrame. --- src/AuDaGe/audage_frame.py | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) create mode 100644 src/AuDaGe/audage_frame.py diff --git a/src/AuDaGe/audage_frame.py b/src/AuDaGe/audage_frame.py new file mode 100644 index 0000000..3e840f7 --- /dev/null +++ b/src/AuDaGe/audage_frame.py @@ -0,0 +1,29 @@ +""" +AuDaGe +""" + +from enum import StrEnum, auto + +import pandas as pd +from pandas import DataFrame + +class MandatoryColumns(StrEnum): + """Enum of columns that are mandatory for a valid AuDaGe DataFrame.""" + NAME = auto() + TYPE = auto() + ADDRESS = auto() + COMMENT = auto() + + +class AuDaGeFrame(DataFrame): + """DataFrame extended for AuDaGe purposes.""" + + def missing_columns(self) -> list[MandatoryColumns]: + return [ + label + for label in MandatoryColumns + if not label in self.columns + ] + + def is_valid(self) -> bool: + return self.missing_columns() == []