diff options
Diffstat (limited to 'src/ee')
-rw-r--r-- | src/ee/_utils.py | 16 |
1 files changed, 11 insertions, 5 deletions
diff --git a/src/ee/_utils.py b/src/ee/_utils.py index 0551b89..1548b89 100644 --- a/src/ee/_utils.py +++ b/src/ee/_utils.py @@ -1,28 +1,33 @@ -import pandas as pd from typing import List +import pandas as pd + + def ensure_has_columns(df: pd.DataFrame, columns: List[str]): all_columns = columns -# print("all_columns={}".format(all_columns)) -# print("df={}".format(df.columns.tolist())) + # print("all_columns={}".format(all_columns)) + # print("df={}".format(df.columns.tolist())) for c in reversed(columns): if not c in df.columns.tolist(): - df.insert(0, column=c, value=pd.Series()) -# print("df={}".format(df.columns.tolist())) + df.insert(0, column=c, value=pd.Series()) + # print("df={}".format(df.columns.tolist())) return df + def run_filters(filters, obj): for f in filters: if not f(obj): return False return True + def any(filters): def f(obj): for f in filters: if f(obj): return True return False + return f @@ -32,4 +37,5 @@ def all(filters): if not f(obj): return False return True + return f |