caf.van.utilities#

Set of utilities for use in the freight tool.

Functions

check_file_path(path, name, *extensions[, ...])

Check that the given path is an existing file.

check_folder(path, name[, create])

Checks if given path is an existing folder.

read_csv(path[, name, columns])

Wrapper function for pandas.read_csv to perform additional checks.

read_excel(path[, name, columns])

Wrapper function for pandas.read_excel to perform additional checks.

read_multi_sheets(path, sheets, **kwargs)

Function to read in multiple excel sheets.

to_dict(df, key_col, val_col[, name])

Transform a dataframe to a dictionary.

Classes

DataPaths(name, path, zc_path)

Dataclass for storing path to data source and zone correspondence.

Parameters([path, params])

Class for reading the parameters given and creating an empty parameter file for input.

Exceptions

MissingColumnsError(name, columns, *args, ...)

Raised when columns are missing from input CSV or spreadsheet.

MissingParameterError(missing, parameterNm, ...)

Raised when a parameter is missing from the input.

MissingWorksheetError(workbook, worksheet, ...)

Raised when worksheet is missing from input spreadsheet.