pyevoc.utils#
Utility functions for I/O, bundled resource access, validation, and shared helpers.
General utility functions used across PyEvoc.
- pyevoc.utils.ensure_dir(path)[source]#
Create path and all missing parent directories, then return it.
Equivalent to
mkdir -p; safe to call on a directory that already exists.
- pyevoc.utils.model_path(name)[source]#
Return a path to a bundled resource in
pyevoc.models.
- pyevoc.utils.read_table(path, **kwargs)[source]#
Read a tabular data file into a
pandas.DataFrame.Dispatches to the appropriate pandas reader based on the file extension. Supported formats:
.csv,.tsv/.tab,.xlsx/.xls,.parquet, and.json.- Parameters:
- Returns:
A
DataFramecontaining the file contents.- Raises:
ValueError – If the file extension is not supported.
- Return type:
DataFrame
- pyevoc.utils.user_model_path(name)[source]#
Return the standard user-level model path, creating the directory.
- pyevoc.utils.validate_column_map(column_map)[source]#
Validate mapping toward the canonical PyEvoc schema.
- pyevoc.utils.validate_columns(columns, required=REQUIRED_COLUMNS)[source]#
Validate that all required columns are present.