diff options
-rw-r--r-- | src/ee/kicad/__init__.py | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/src/ee/kicad/__init__.py b/src/ee/kicad/__init__.py index 1261cb5..d89c209 100644 --- a/src/ee/kicad/__init__.py +++ b/src/ee/kicad/__init__.py @@ -20,6 +20,7 @@ __all__ = [ def to_pandas(obj: Any, **kwarg): import pandas + import numpy as np def run_filter(filters, obj): for f in filters: @@ -63,9 +64,11 @@ def to_pandas(obj: Any, **kwarg): columns = set([key for row in data for key in list(row)]) - set(special_fields) columns = special_fields + list(columns) - return pandas.DataFrame(data=data, columns=columns). \ + df = pandas.DataFrame(data=data, columns=columns). \ set_index("ref"). \ - sort_values(["ref_type", "ref_num"]) + sort_values(["ref_type", "ref_num"]). \ + applymap(lambda s: s if isinstance(s, str) else None) + return df if isinstance(obj, Schematic): return to_pandas_schematic(obj) |