Spaces:
Running
Running
File size: 748 Bytes
136af2d |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 |
import yaml
import sys
# read scanners from yaml file
# return a list of scanners
def read_scanners(path):
scanners = []
with open(path, "r") as f:
config = yaml.load(f, Loader=yaml.FullLoader)
scanners = config.get("detectors", None)
return scanners
# convert a list of scanners to yaml file
def write_scanners(scanners):
with open("./scan_config.yaml", "w") as f:
# save scanners to detectors in yaml
yaml.dump({"detectors": scanners}, f)
# convert column mapping dataframe to json
def convert_column_mapping_to_json(df, label=""):
column_mapping = {}
column_mapping[label] = []
for _, row in df.iterrows():
column_mapping[label].append(row.tolist())
return column_mapping |