diff options
author | Trygve Laugstøl <trygvis@inamo.no> | 2018-08-04 18:55:23 +0200 |
---|---|---|
committer | Trygve Laugstøl <trygvis@inamo.no> | 2018-08-04 18:55:23 +0200 |
commit | 46695e31f2535fbb0c8b0d3989fb365f8e3456ed (patch) | |
tree | e0c3549441e4363a778c5065d81915a33a44b269 /src | |
parent | c0ff8514c2ad53cb532cb60c45321595be4cd20e (diff) | |
download | ee-python-46695e31f2535fbb0c8b0d3989fb365f8e3456ed.tar.gz ee-python-46695e31f2535fbb0c8b0d3989fb365f8e3456ed.tar.bz2 ee-python-46695e31f2535fbb0c8b0d3989fb365f8e3456ed.tar.xz ee-python-46695e31f2535fbb0c8b0d3989fb365f8e3456ed.zip |
o Reformat.
Diffstat (limited to 'src')
-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 |