From 46695e31f2535fbb0c8b0d3989fb365f8e3456ed Mon Sep 17 00:00:00 2001 From: Trygve Laugstøl Date: Sat, 4 Aug 2018 18:55:23 +0200 Subject: o Reformat. --- src/ee/_utils.py | 16 +++++++++++----- 1 file 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 -- cgit v1.2.3