diff options
author | Trygve Laugstøl <trygvis@inamo.no> | 2017-10-22 09:43:54 +0200 |
---|---|---|
committer | Trygve Laugstøl <trygvis@inamo.no> | 2017-10-22 09:43:54 +0200 |
commit | 826a0eb82cc786d480888f3a032df95447c133b8 (patch) | |
tree | e8db0701756bf23283316ef04f13f364e37af6c2 /src/ee/_utils.py | |
parent | 0073712b71ea642edc2b67ad64a09cc0f54a137f (diff) | |
download | ee-python-826a0eb82cc786d480888f3a032df95447c133b8.tar.gz ee-python-826a0eb82cc786d480888f3a032df95447c133b8.tar.bz2 ee-python-826a0eb82cc786d480888f3a032df95447c133b8.tar.xz ee-python-826a0eb82cc786d480888f3a032df95447c133b8.zip |
digikey.to_pandas(): Make sure that 'Digi-Key', 'MPN' and 'URL' fields
always are in the data frame.
kicad.to_pandas(): support Schematics objects too.
read_schematics(): Support hierarchical labels.
Diffstat (limited to 'src/ee/_utils.py')
-rw-r--r-- | src/ee/_utils.py | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/src/ee/_utils.py b/src/ee/_utils.py new file mode 100644 index 0000000..598bca1 --- /dev/null +++ b/src/ee/_utils.py @@ -0,0 +1,12 @@ +import pandas as pd +from typing import List + +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())) + 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())) + return df |