Skip to main content

load_data_context

Function load_data_context 

Source
pub fn load_data_context(path: &Path) -> Result<DataContext, DataInputError>
Expand description

Load a DataContext from path.

The file format is inferred from the extension:

  • .json — a JSON object (used directly) or a JSON array (first element must be an object; empty array or non-object first element → error). Nested objects are flattened to dot-path keys ({"a":{"b":1}}"a.b" => "1"). Scalar values: strings are used as-is; numbers and booleans are converted via to_string; null → empty string. Arrays nested inside a data object are skipped.
  • .csv — header row gives field names; the first data row supplies values. No data rows → error.
  • Any other extension → error.

Returns Err(DataInputError) on any I/O, parse, or shape failure.