sda.api.parse_test_file#

Attributes#

Functions#

parse_test_files(files[, drop_unnamed_columns, ...])

Parse experiment files using unified Excel table detection.

Module Contents#

sda.api.parse_test_file.param_dict#
sda.api.parse_test_file.parse_test_files(files, drop_unnamed_columns=True, command=None, dropna=True, columns_to_keep=None, verbose=1, column_not_found='raise', table_not_found='raise', suppress_polars_warnings=False)#

Parse experiment files using unified Excel table detection.

Uses ExcelFileHandler with XML Discovery + Polars reading for maximum performance and accuracy. Automatically detects Excel Table objects (Insert > Table in Excel) for robust data loading.

Parameters:
  • files (str | Path | list | dict[str, dict] | dict[Path, dict]) –

    Files to parse. Can be:

    • str: filename

    • Path: filename

    • list: list of filenames

    • dict: {filename : special_reading_commands} (legacy parameter, mostly ignored)

      • filename: str

      • special_reading_commands: dict (legacy, mostly ignored in favor of table detection)

  • drop_unnamed_columns (bool, optional) – If True, drop unnamed columns (columns with no name), default to True.

  • command (dict, optional) – Legacy reading commands. Now largely ignored in favor of automatic Excel table detection. For CSV files, standard pandas parameters still apply.

  • dropna (bool) – Drop rows with all NaN, default to True.

  • columns_to_keep (list) – List of columns to keep for filtering (default: None)

  • verbose (int) – Verbosity level (default: 1). If 0, no output. If 1, print progress with basic information. If 2, print detailed file processing information.

  • column_not_found (str) –

    What to do if a column is not found in the file. Can be ‘raise’, ‘warn’, or ‘ignore’.

    • ’raise’: raise an error if a column is not found.

    • ’warn’: print a warning if a column is not found.

    • ’ignore’: do nothing if a column is not found.

  • table_not_found (str) –

    What to do if no Excel tables are found in a file. Can be ‘raise’ or ‘warn’.

    • ’raise’: raise a TableNotFoundError if no tables are found (default).

    • ’warn’: print a warning if no tables are found and skip the file.

  • suppress_polars_warnings (bool) – If True, suppress Polars dtype warning messages during reading (default: False).

Returns:

Combined DataFrame from all processed files with automatic table detection

Return type:

pd.DataFrame

Examples

>>> files = ["T137.xlsx", "T153.xlsx"]
>>> df = parse_test_files(files)
>>> files = {"test_data.xlsx": {}}  # Empty dict uses table detection
>>> df = parse_test_files(files)

Notes

Uses ExcelFileHandler with XML-based table discovery and Polars reading engine for optimal performance. Legacy pandas sheet-based reading is deprecated.