compass.utilities.finalize.save_db#
- save_db(db, out_dir, output_columns)[source]#
Write the combined ordinance output to disk
Qualitative and quantitative ordinances are written to a single
ordinances.csvfile. Thequantitativeflag is retained as a column so the two kinds of row remain distinguishable.- Parameters:
db (
pandas.DataFrame) – Ordinance dataset containing the full set of output columns, plus thequantitativeboolean flag.out_dir (path-like) – Directory where
ordinances.csvshould be written. The directory is created bypathlib.Pathif necessary.output_columns (
list) – List of expected output columns (ascompass.plugin.interface.OutputColumninstances) for the consolidated database. The function enforces the presence of these columns in the outputpandas.DataFrame, filling in missing columns with null values as needed.
Notes
Empty DataFrames short-circuit without creating output files. The function assumes the boolean
quantitativecolumn has already been sanitized bydoc_infos_to_db().