autods_pet.io#

I/O utilities for patient lists and data export.

autods_pet.io.read_patient_list(path)[source]#

Read a text file of patient IDs (one per line, # comments allowed).

Parameters:

path (Path) – Path to the patient list text file.

Returns:

Patient IDs with whitespace stripped; blank lines and #-comments are excluded.

Return type:

list[str]

Raises:

FileNotFoundError – If path does not exist.

autods_pet.io.save_dataframe(df, path, output_format='csv')[source]#

Save a DataFrame as CSV or Excel.

Parameters:
  • df (DataFrame) – DataFrame to save.

  • path (str | Path) – Output file path. If output_format is "xlsx", the extension is changed to .xlsx automatically.

  • output_format (str (default: 'csv')) – "csv" (default) or "xlsx".

Returns:

The actual path written (may differ from path if extension changed).

Return type:

Path